]> xenbits.xensource.com Git - people/julieng/linux-arm.git/log
people/julieng/linux-arm.git
9 years agoxen/pci: Don't build Xen pci code for ARM and ARM64 centos-dev
Julien Grall [Mon, 28 Sep 2015 13:14:23 +0000 (14:14 +0100)]
xen/pci: Don't build Xen pci code for ARM and ARM64

The PCI support for Xen doesn't compile on ARM/ARM64 when
CONFIG_PCI_MMCONFIG=y:

drivers/xen/pci.c:31:25: fatal error: asm/pci_x86.h: No such file or
directory
 #include <asm/pci_x86.h>

Although, Xen is not currently involved in PCI management for ARM/ARM64.
There is plan to support it, but it would require some changes in Linux
side.

For now, introduce a new config options XEN_PCI which will be turned off
for ARM platform.

Reported-by: Robert Richter <robert.richter@caviumnetworks.com>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
9 years agofb/xen-fbfront: Support 64KB pages
Julien Grall [Fri, 28 Aug 2015 17:54:56 +0000 (18:54 +0100)]
fb/xen-fbfront: Support 64KB pages

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agoxen/gnttdev: Add support for 64KB pages
Julien Grall [Wed, 12 Aug 2015 17:02:06 +0000 (18:02 +0100)]
xen/gnttdev: Add support for 64KB pages

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agoxenbus: Support multiple page ring with 64KB
Julien Grall [Tue, 11 Aug 2015 13:18:56 +0000 (14:18 +0100)]
xenbus: Support multiple page ring with 64KB

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agoxen/xenbus: Rename *RING_PAGE* to *RING_GRANT*
Julien Grall [Tue, 11 Aug 2015 10:23:54 +0000 (11:23 +0100)]
xen/xenbus: Rename *RING_PAGE* to *RING_GRANT*

Linux may use a different page size than the size of grant. So make
clear that the order is actually in number of grant.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agoxen/swiotlb: Add support for 64KB page granularity
Julien Grall [Wed, 9 Sep 2015 14:18:45 +0000 (15:18 +0100)]
xen/swiotlb: Add support for 64KB page granularity

Swiotlb is used on ARM64 to support DMA on platform where devices are
not protected by an SMMU. Furthermore it's only enabled for DOM0.

While Xen is always using 4KB page granularity in the stage-2 page table,
Linux ARM64 may either use 4KB or 64KB. This means that a Linux page
can be spanned accross multiple Xen page.

The Swiotlb code has to validate that the buffer used for DMA is
physically contiguous in the memory. As a Linux page can't be shared
between local memory and foreign page by design (the balloon code always
removing entirely a Linux page), the changes in the code are very
minimal because we only need to check the first Xen PFN.

Note that it may be possible to optimize the function
check_page_physically_contiguous to avoid looping over every Xen PFN
for local memory. Although I will let this optimization for a follow-up.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/swiotlb: Pass addresses rather than frame numbers to xen_arch_need_swiotlb
Julien Grall [Wed, 9 Sep 2015 14:17:33 +0000 (15:17 +0100)]
xen/swiotlb: Pass addresses rather than frame numbers to xen_arch_need_swiotlb

With 64KB page granularity support, the frame number will be different.

It will be easier to modify the behavior in a single place rather than
in each caller.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoblock/xen-blkfront: Handle non-indirect grant with 64KB pages
Julien Grall [Thu, 13 Aug 2015 12:13:35 +0000 (13:13 +0100)]
block/xen-blkfront: Handle non-indirect grant with 64KB pages

The minimal size of request in the block framework is always PAGE_SIZE.
It means that when 64KB guest is support, the request will at least be
64KB.

Although, if the backend doesn't support indirect grant (such as QDISK
in QEMU), a ring request is only able to accomodate 11 segments of 4KB
(i.e 44KB).

The current frontend is assuming that an I/O request will always fit in
a ring request. This is not true any more when using 64KB page
granularity and will therefore crash during the boot.

On ARM64, the ABI is completely neutral to the page granularity used by
the domU. The guest has the choice between different page granularity
supported by the processors (for instance on ARM64: 4KB, 16KB, 64KB).
This can't be enforced by the hypervisor and therefore it's possible to
run guests using different page granularity.

So we can't mandate the block backend to support non-indirect grant
when the frontend is using 64KB page granularity and have to fix it
properly in the frontend.

The solution exposed below is based on modifying directly the frontend
guest rather than asking the block framework to support smaller size
(i.e < PAGE_SIZE). This is because the change is the block framework are
not trivial as everything seems to relying on a struct *page (see [1]).
Although, it may be possible that someone succeed to do it in the future
and we would therefore be able to use advantage.

Given that a block request may not fit in a single ring request, a
second request is introduced for the data that cannot fit in the first
one. This means that the second request should never be used on Linux
configuration using a page granularity < 44KB.

Note that the parameters blk_queue_max_* helpers haven't been updated.
The block code will set mimimum size supported and we may be able  to
support directly any change in the block framework that lower down the
mimimal size of a request.

[1] http://lists.xen.org/archives/html/xen-devel/2015-08/msg02200.html

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agoblock/xen-blkfront: Introduce blkif_ring_get_request
Julien Grall [Thu, 13 Aug 2015 18:23:10 +0000 (19:23 +0100)]
block/xen-blkfront: Introduce blkif_ring_get_request

The code to get a request is always the same. Therefore we can factorize
it in a single function.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agoarm/xen: Add support for 64KB page granularity
Julien Grall [Tue, 5 May 2015 15:36:56 +0000 (16:36 +0100)]
arm/xen: Add support for 64KB page granularity

The hypercall interface is always using 4KB page granularity. This is
requiring to use xen page definition macro when we deal with hypercall.

Note that pfn_to_gfn is working with a Xen pfn (i.e 4KB). We may want to
rename pfn_gfn to make this explicit.

We also allocate a 64KB page for the shared page even though only the
first 4KB is used. I don't think this is really important for now as it
helps to have the pointer 4KB aligned (XENMEM_add_to_physmap is taking a
Xen PFN).

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/privcmd: Add support for Linux 64KB page granularity
Julien Grall [Tue, 5 May 2015 15:54:12 +0000 (16:54 +0100)]
xen/privcmd: Add support for Linux 64KB page granularity

The hypercall interface (as well as the toolstack) is always using 4KB
page granularity. When the toolstack is asking for mapping a series of
guest PFN in a batch, it expects to have the page map contiguously in
its virtual memory.

When Linux is using 64KB page granularity, the privcmd driver will have
to map multiple Xen PFN in a single Linux page.

Note that this solution works on page granularity which is a multiple of
4KB.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
9 years agonet/xen-netback: Make it running on 64KB page granularity
Julien Grall [Tue, 5 May 2015 12:15:29 +0000 (13:15 +0100)]
net/xen-netback: Make it running on 64KB page granularity

The PV network protocol is using 4KB page granularity. The goal of this
patch is to allow a Linux using 64KB page granularity working as a
network backend on a non-modified Xen.

It's only necessary to adapt the ring size and break skb data in small
chunk of 4KB. The rest of the code is relying on the grant table code.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agonet/xen-netfront: Make it running on 64KB page granularity
Julien Grall [Fri, 10 Apr 2015 13:42:21 +0000 (14:42 +0100)]
net/xen-netfront: Make it running on 64KB page granularity

The PV network protocol is using 4KB page granularity. The goal of this
patch is to allow a Linux using 64KB page granularity using network
device on a non-modified Xen.

It's only necessary to adapt the ring size and break skb data in small
chunk of 4KB. The rest of the code is relying on the grant table code.

Note that we allocate a Linux page for each rx skb but only the first
4KB is used. We may improve the memory usage by extending the size of
the rx skb.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
9 years agoblock/xen-blkback: Make it running on 64KB page granularity
Julien Grall [Tue, 5 May 2015 15:25:56 +0000 (16:25 +0100)]
block/xen-blkback: Make it running on 64KB page granularity

The PV block protocol is using 4KB page granularity. The goal of this
patch is to allow a Linux using 64KB page granularity behaving as a
block backend on a non-modified Xen.

It's only necessary to adapt the ring size and the number of request per
indirect frames. The rest of the code is relying on the grant table
code.

Note that the grant table code is allocating a Linux page per grant
which will result to waste 6OKB for every grant when Linux is using 64KB
page granularity. This could be improved by sharing the page between
multiple grants.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: "Roger Pau Monné" <roger.pau@citrix.com>
9 years agoblock/xen-blkfront: Make it running on 64KB page granularity
Julien Grall [Wed, 22 Jul 2015 15:44:54 +0000 (16:44 +0100)]
block/xen-blkfront: Make it running on 64KB page granularity

The PV block protocol is using 4KB page granularity. The goal of this
patch is to allow a Linux using 64KB page granularity using block
device on a non-modified Xen.

The block API is using segment which should at least be the size of a
Linux page. Therefore, the driver will have to break the page in chunk
of 4K before giving the page to the backend.

When breaking a 64KB segment in 4KB chunks, it is possible that some
chunks are empty. As the PV protocol always require to have data in the
chunk, we have to count the number of Xen page which will be in use and
avoid sending empty chunks.

Note that, a pre-defined number of grants are reserved before preparing
the request. This pre-defined number is based on the number and the
maximum size of the segments. If each segment contains a very small
amount of data, the driver may reserve too many grants (16 grants is
reserved per segment with 64KB page granularity).

Furthermore, in the case of persistent grants we allocate one Linux page
per grant although only the first 4KB of the page will be effectively
in use. This could be improved by sharing the page with multiple grants.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
9 years agoxen/grant-table: Make it running on 64KB granularity
Julien Grall [Tue, 5 May 2015 15:37:49 +0000 (16:37 +0100)]
xen/grant-table: Make it running on 64KB granularity

The Xen interface is using 4KB page granularity. This means that each
grant is 4KB.

The current implementation allocates a Linux page per grant. On Linux
using 64KB page granularity, only the first 4KB of the page will be
used.

We could decrease the memory wasted by sharing the page with multiple
grant. It will require some care with the {Set,Clear}ForeignPage macro.

Note that no changes has been made in the x86 code because both Linux
and Xen will only use 4KB page granularity.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/events: fifo: Make it running on 64KB granularity
Julien Grall [Tue, 5 May 2015 15:37:30 +0000 (16:37 +0100)]
xen/events: fifo: Make it running on 64KB granularity

Only use the first 4KB of the page to store the events channel info. It
means that we will waste 60KB every time we allocate page for:
     * control block: a page is allocating per CPU
     * event array: a page is allocating everytime we need to expand it

I think we can reduce the memory waste for the 2 areas by:

    * control block: sharing between multiple vCPUs. Although it will
    require some bookkeeping in order to not free the page when the CPU
    goes offline and the other CPUs sharing the page still there

    * event array: always extend the array event by 64K (i.e 16 4K
    chunk). That would require more care when we fail to expand the
    event channel.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@citrix.com>
9 years agoxen/balloon: Don't rely on the page granularity is the same for Xen and Linux
Julien Grall [Mon, 4 May 2015 14:39:08 +0000 (15:39 +0100)]
xen/balloon: Don't rely on the page granularity is the same for Xen and Linux

For ARM64 guests, Linux is able to support either 64K or 4K page
granularity. Although, the hypercall interface is always based on 4K
page granularity.

With 64K page granularity, a single page will be spread over multiple
Xen frame.

To avoid splitting the page into 4K frame, take advantage of the
extent_order field to directly allocate/free chunk of the Linux page
size.

Note that PVMMU is only used for PV guest (which is x86) and the page
granularity is always 4KB. Some BUILD_BUG_ON has been added to ensure
that because the code has not been modified.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agotty/hvc: xen: Use xen page definition
Julien Grall [Tue, 5 May 2015 15:58:43 +0000 (16:58 +0100)]
tty/hvc: xen: Use xen page definition

The console ring is always based on the page granularity of Xen.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/xenbus: Use Xen page definition
Julien Grall [Tue, 5 May 2015 15:38:27 +0000 (16:38 +0100)]
xen/xenbus: Use Xen page definition

All the ring (xenstore, and PV rings) are always based on the page
granularity of Xen.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/biomerge: Don't allow biovec's to be merged when Linux is not using 4KB pages
Julien Grall [Mon, 11 May 2015 12:44:21 +0000 (13:44 +0100)]
xen/biomerge: Don't allow biovec's to be merged when Linux is not using 4KB pages

On ARM all dma-capable devices on a same platform may not be protected
by an IOMMU. The DMA requests have to use the BFN (i.e MFN on ARM) in
order to use correctly the device.

While the DOM0 memory is allocated in a 1:1 fashion (PFN == MFN), grant
mapping will screw this contiguous mapping.

When Linux is using 64KB page granularitary, the page may be split
accross multiple non-contiguous MFN (Xen is using 4KB page
granularity). Therefore a DMA request will likely fail.

Checking that a 64KB page is using contiguous MFN is tedious. For
now, always says that biovec are not mergeable.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoblock/xen-blkfront: split get_grant in 2
Julien Grall [Wed, 1 Jul 2015 13:10:38 +0000 (14:10 +0100)]
block/xen-blkfront: split get_grant in 2

Prepare the code to support 64KB page granularity. The first
implementation will use a full Linux page per indirect and persistent
grant. When non-persistent grant is used, each page of a bio request
may be split in multiple grant.

Furthermore, the field page of the grant structure is only used to copy
data from persistent grant or indirect grant. Avoid to set it for other
use case as it will have no meaning given the page will be split in
multiple grant.

Provide 2 functions, to setup indirect grant, the other for bio page.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
9 years agoblock/xen-blkfront: Store a page rather a pfn in the grant structure
Julien Grall [Tue, 30 Jun 2015 10:58:51 +0000 (11:58 +0100)]
block/xen-blkfront: Store a page rather a pfn in the grant structure

All the usage of the field pfn are done using the same idiom:

pfn_to_page(grant->pfn)

This will  return always the same page. Store directly the page in the
grant to clean up the code.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoblock/xen-blkfront: Split blkif_queue_request in 2
Julien Grall [Mon, 29 Jun 2015 16:35:24 +0000 (17:35 +0100)]
block/xen-blkfront: Split blkif_queue_request in 2

Currently, blkif_queue_request has 2 distinct execution path:
    - Send a discard request
    - Send a read/write request

The function is also allocating grants to use for generating the
request. Although, this is only used for read/write request.

Rather than having a function with 2 distinct execution path, separate
the function in 2. This will also remove one level of tabulation.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
9 years agoxen/grant: Add helper gnttab_page_grant_foreign_access_ref_one
Julien Grall [Fri, 19 Jun 2015 17:05:06 +0000 (18:05 +0100)]
xen/grant: Add helper gnttab_page_grant_foreign_access_ref_one

Many PV drivers contain the idiom:

pfn = page_to_gfn(...) /* Or similar */
gnttab_grant_foreign_access_ref

Replace it by a new helper. Note that when Linux is using a different
page granularity than Xen, the helper only gives access to the first 4KB
grant.

This is useful where drivers are allocating a full Linux page for each
grant.

Also include xen/interface/grant_table.h rather than xen/grant_table.h in
asm/page.h for x86 to fix a compilation issue [1]. Only the former is
useful in order to get the structure definition.

[1] Interdependency between asm/page.h and xen/grant_table.h which result
to page_mfn not being defined when necessary.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/grant: Introduce helpers to split a page into grant
Julien Grall [Fri, 19 Jun 2015 16:49:03 +0000 (17:49 +0100)]
xen/grant: Introduce helpers to split a page into grant

Currently, a grant is always based on the Xen page granularity (i.e
4KB). When Linux is using a different page granularity, a single page
will be split between multiple grants.

The new helpers will be in charge of splitting the Linux page into grants
and call a function given by the caller on each grant.

Also provide an helper to count the number of grants within a given
contiguous region.

Note that the x86/include/asm/xen/page.h is now including
xen/interface/grant_table.h rather than xen/grant_table.h. It's
necessary because xen/grant_table.h depends on asm/xen/page.h and will
break the compilation. Furthermore, only definition in
interface/grant_table.h is required.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen: Add Xen specific page definition
Julien Grall [Mon, 4 May 2015 14:47:16 +0000 (15:47 +0100)]
xen: Add Xen specific page definition

The Xen hypercall interface is always using 4K page granularity on ARM
and x86 architecture.

With the incoming support of 64K page granularity for ARM64 guest, it
won't be possible to re-use the Linux page definition in Xen drivers.

Introduce Xen page definition helpers based on the Linux page
definition. They have exactly the same name but prefixed with
XEN_/xen_ prefix.

Also modify xen_page_to_gfn to use new Xen page definition.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/xen: Drop pte_mfn and mfn_pte
Julien Grall [Tue, 21 Jul 2015 16:57:20 +0000 (17:57 +0100)]
arm/xen: Drop pte_mfn and mfn_pte

They are not used in common code expect in one place in balloon.c which is
only compiled when Linux is using PV MMU. It's not the case on ARM.

Rather than worrying how to handle the 64KB case, drop them.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agonet/xen-netback: xenvif_gop_frag_copy: move GSO check out of the loop
Julien Grall [Wed, 24 Jun 2015 17:03:14 +0000 (18:03 +0100)]
net/xen-netback: xenvif_gop_frag_copy: move GSO check out of the loop

The skb doesn't change within the function. Therefore it's only
necessary to check if we need GSO once at the beginning.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoxen/xenbus: Rename the variable xen_store_mfn to xen_store_gfn
Julien Grall [Fri, 7 Aug 2015 16:34:42 +0000 (17:34 +0100)]
xen/xenbus: Rename the variable xen_store_mfn to xen_store_gfn

The variable xen_store_mfn is effectively storing a GFN and not an MFN.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoxen/privcmd: Further s/MFN/GFN/ clean-up
Julien Grall [Fri, 7 Aug 2015 16:34:41 +0000 (17:34 +0100)]
xen/privcmd: Further s/MFN/GFN/ clean-up

The privcmd code is mixing the usage of GFN and MFN within the same
functions which make the code difficult to understand when you only work
with auto-translated guests.

The privcmd driver is only dealing with GFN so replace all the mention
of MFN into GFN.

The ioctl structure used to map foreign change has been left unchanged
given that the userspace is using it. Nonetheless, add a comment to
explain the expected value within the "mfn" field.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agohvc/xen: Further s/MFN/GFN clean-up
Julien Grall [Fri, 7 Aug 2015 16:34:40 +0000 (17:34 +0100)]
hvc/xen: Further s/MFN/GFN clean-up

HVM_PARAM_CONSOLE_PFN is used to retrieved the console PFN for HVM
guest. It returns a PFN (aka GFN) and not a MFN.

Furthermore, use directly virt_to_gfn for both PV and HVM domain rather
than doing a special case for each of the them.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agovideo/xen-fbfront: Further s/MFN/GFN clean-up
Julien Grall [Fri, 7 Aug 2015 16:34:39 +0000 (17:34 +0100)]
video/xen-fbfront: Further s/MFN/GFN clean-up

The PV driver xen-fbfront is only dealing with GFN and not MFN. Rename
all the occurence of MFN to GFN.

Also take the opportunity to replace to usage of pfn_to_gfn by
xen_page_to_gfn.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoxen/tmem: Use xen_page_to_gfn rather than pfn_to_gfn
Julien Grall [Fri, 7 Aug 2015 16:34:38 +0000 (17:34 +0100)]
xen/tmem: Use xen_page_to_gfn rather than pfn_to_gfn

All the caller of xen_tmem_{get,put}_page have a struct page * in hand
and call pfn_to_gfn for the only benefits of these 2 functions.

Rather than passing the pfn in parameter, pass directly the page and use
directly xen_page_to_gfn.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoxen: Use correctly the Xen memory terminologies
Julien Grall [Fri, 7 Aug 2015 16:34:37 +0000 (17:34 +0100)]
xen: Use correctly the Xen memory terminologies

Based on include/xen/mm.h [1], Linux is mistakenly using MFN when GFN
is meant, I suspect this is because the first support for Xen was for
PV. This resulted in some misimplementation of helpers on ARM and
confused developers about the expected behavior.

For instance, with pfn_to_mfn, we expect to get an MFN based on the name.
Although, if we look at the implementation on x86, it's returning a GFN.

For clarity and avoid new confusion, replace any reference to mfn with
gfn in any helpers used by PV drivers. The x86 code will still keep some
reference of pfn_to_mfn which may be used by all kind of guests
No changes as been made in the hypercall field, even
though they may be invalid, in order to keep the same as the defintion
in xen repo.

Note that page_to_mfn has been renamed to xen_page_to_gfn to avoid a
name to close to the KVM function gfn_to_page.

Take also the opportunity to simplify simple construction such
as pfn_to_mfn(page_to_pfn(page)) into xen_page_to_gfn. More complex clean up
will come in follow-up patches.

[1] http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=e758ed14f390342513405dd766e874934573e6cb

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoarm/xen: implement correctly pfn_to_mfn
Julien Grall [Fri, 7 Aug 2015 16:34:36 +0000 (17:34 +0100)]
arm/xen: implement correctly pfn_to_mfn

After the commit introducing convertion between DMA and guest addresses,
all the callers of pfn_to_mfn are expecting to get a GFN (Guest Frame
Number). On ARM, all the guests are auto-translated so the GFN is equal
to the Linux PFN (Pseudo-physical Frame Number).

The current implementation may return an MFN if the caller is passing a
PFN associated to a mapped foreign grant. In pratice, I haven't seen
the problem on running guest but we should fix it for the sake of
correctness.

Correct the implementation by always returning the pfn passed in parameter.

A follow-up patch will take care to rename pfn_to_mfn to a suitable
name.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoxen: Make clear that swiotlb and biomerge are dealing with DMA address
Julien Grall [Fri, 7 Aug 2015 16:34:35 +0000 (17:34 +0100)]
xen: Make clear that swiotlb and biomerge are dealing with DMA address

The swiotlb is required when programming a DMA address on ARM when a
device is not protected by an IOMMU.

In this case, the DMA address should always be equal to the machine address.
For DOM0 memory, Xen ensure it by have an identity mapping between the
guest address and host address. However, when mapping a foreign grant
reference, the 1:1 model doesn't work.

For ARM guest, most of the callers of pfn_to_mfn expects to get a GFN
(Guest Frame Number), i.e a PFN (Page Frame Number) from the Linux point
of view given that all ARM guest are auto-translated.

Even though the name pfn_to_mfn is misleading, we need to ensure that
those caller get a GFN and not by mistake a MFN. In pratical, I haven't
seen error related to this but we should fix it for the sake of
correctness.

In order to fix the implementation of pfn_to_mfn on ARM in a follow-up
patch, we have to introduce new helpers to return the DMA from a PFN and
the invert.

On x86, the new helpers will be an alias of pfn_to_mfn and mfn_to_pfn.

The helpers will be used in swiotlb and xen_biovec_phys_mergeable.

This is necessary in the latter because we have to ensure that the
biovec code will not try to merge a biovec using foreign page and
another using Linux memory.

Lastly, the helper mfn_to_local_pfn has been renamed to bfn_to_local_pfn
given that the only usage was in swiotlb.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoarm/xen: Remove helpers which are PV specific
Julien Grall [Fri, 7 Aug 2015 16:34:34 +0000 (17:34 +0100)]
arm/xen: Remove helpers which are PV specific

ARM guests are always HVM. The current implementation is assuming a 1:1
mapping which is only true for DOM0 and may not be at all in the future.

Furthermore, all the helpers but arbitrary_virt_to_machine are used in
x86 specific code (or only compiled for).

The helper arbitrary_virt_to_machine is only used in PV specific code.
Therefore we should never call the function.

Add a BUG() in this helper and drop all the others.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoxen-blkfront: convert to blk-mq APIs
Bob Liu [Mon, 13 Jul 2015 09:55:24 +0000 (17:55 +0800)]
xen-blkfront: convert to blk-mq APIs

Note: This patch is based on original work of Arianna's internship for
GNOME's Outreach Program for Women.

Only one hardware queue is used now, so there is no significant
performance change

The legacy non-mq code is deleted completely which is the same as other
drivers like virtio, mtip, and nvme.

Also dropped one unnecessary holding of info->io_lock when calling
blk_mq_stop_hw_queues().

Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@fb.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
9 years agoThunderx, numa: workaround CPU95 startup timeout issue centos-baseline
Vadim Lomovtsev [Fri, 18 Sep 2015 12:17:21 +0000 (05:17 -0700)]
Thunderx, numa: workaround CPU95 startup timeout issue

Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoCompiler bug workaround!!!
Tomasz Nowicki [Thu, 26 Mar 2015 10:07:18 +0000 (11:07 +0100)]
Compiler bug workaround!!!

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoRevert "net: thunderx: remove effective "default y" from Kconfig if ARCH_THUNDER=y"
Robert Richter [Thu, 10 Sep 2015 13:00:57 +0000 (15:00 +0200)]
Revert "net: thunderx: remove effective "default y" from Kconfig if ARCH_THUNDER=y"

This reverts commit 22f54bf932a0eed73134b696b238db4bdcff5cd4.

Reverting until replaced with a better solution to configure ThunderX.

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agopci, thunder, acpi: Fix ITS initialization for ACPI
Robert Richter [Wed, 12 Aug 2015 11:31:38 +0000 (13:31 +0200)]
pci, thunder, acpi: Fix ITS initialization for ACPI

Since pci bridges are enable with generic acpi pci code now, the its
was no longer initialized which leads to bad requester IDs for
ITS. Fixing that by moving its initialization to ThunderX bridge
fixup. The setup is now done for both, acpi and devicetree.

This should also fix broken pci root complexes for other vendor's
since the previous ACPI code enabled ThunderX requester IDs on all
systems without any device or vendor check.

It was root caused by Tomasz Nowicki <tn@semihalf.com>.

Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64, ACPI, PCI, MSI: I/O Remapping Table (IORT) initial support.
Tomasz Nowicki [Wed, 29 Jul 2015 10:17:33 +0000 (12:17 +0200)]
ARM64, ACPI, PCI, MSI: I/O Remapping Table (IORT) initial support.

IORT shows representation of IO topology that will be used by
ARM based systems. It describes how various components are connected
together e.g. which devices are connected to given ITS instance.

This patch implements calls which allow to:
- register/remove ITS as MSI chip
- parse all IORT nodes and form node tree (for easy lookup)
- find ITS (MSI chip) that device is assigned to

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agopci, acpi, dma: Unify coherency checking logic for PCI devices.
Tomasz Nowicki [Tue, 28 Jul 2015 15:51:27 +0000 (17:51 +0200)]
pci, acpi, dma: Unify coherency checking logic for PCI devices.

ACPI spec5.1 states that the value of _CCA is inherited by all
descendants of bus master devices, root PCI bridge in this case.
So this patch is checking if PCI device's root bridge has coherency
flag set and then mounts DMA ops (in similar way as DT does).

Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, acpi, pci: Omit OF related IRQ parsing when running with ACPI kernel.
Tomasz Nowicki [Tue, 28 Jul 2015 15:42:40 +0000 (17:42 +0200)]
arm64, acpi, pci: Omit OF related IRQ parsing when running with ACPI kernel.

Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64: topology: Use acpi_disabled for ACPI check
Robert Richter [Fri, 3 Jul 2015 17:47:12 +0000 (19:47 +0200)]
arm64: topology: Use acpi_disabled for ACPI check

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoacpi, property: Fix EXPORT_SYMBOL_GPL() for acpi_dev_prop_read_single()
Robert Richter [Thu, 25 Jun 2015 14:59:41 +0000 (16:59 +0200)]
acpi, property: Fix EXPORT_SYMBOL_GPL() for acpi_dev_prop_read_single()

Fixing the following build error when building drivers as modules:

 ERROR: "acpi_dev_prop_read_single" [drivers/net/phy/mdio-octeon.ko] undefined!
 ERROR: "acpi_dev_prop_read_single" [drivers/net/ethernet/cavium/thunder/thunder_bgx.ko] undefined!

Reported-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoFixes to get ACPI based kernel booting. Temporary fix to get going.
Narinder [Thu, 11 Jun 2015 21:53:00 +0000 (14:53 -0700)]
Fixes to get ACPI based kernel booting. Temporary fix to get going.

Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64 / ACPI: Point KVM to the virtual timer interrupt when booting with ACPI
Tomasz Nowicki [Tue, 24 Mar 2015 03:31:58 +0000 (20:31 -0700)]
ARM64 / ACPI: Point KVM to the virtual timer interrupt when booting with ACPI

With ACPI enabled, kvm_timer_hyp_init can't access any device tree
information. Although registration of the virtual timer interrupt
already happened when architected timers were initialized, we need to
point KVM to the interrupt line used.

Signed-off-by: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoacpi, property: Export acpi_dev_prop_read call to be usable for kernel modules.
Tomasz Nowicki [Fri, 30 Jan 2015 07:51:15 +0000 (08:51 +0100)]
acpi, property: Export acpi_dev_prop_read call to be usable for kernel modules.

Fix for *Bug 14123* - "Error while trying to compile VNIC and BGX drivers
                       as Loadable Kernel Modules"

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64/acpi/pci: provide hook for MCFG fixups
Tomasz Nowicki [Fri, 12 Dec 2014 08:41:23 +0000 (09:41 +0100)]
arm64/acpi/pci: provide hook for MCFG fixups

Some MCFG tables may be broken or the underlying hardware may not
be fully compliant with the PCIe ECAM mechanism. This patch provides
a mechanism to override the default mmconfig read/write routines
and/or do other MCFG related fixups.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agonet, thunder, bgx: Rework driver to support ACPI binding.
Tomasz Nowicki [Tue, 16 Dec 2014 17:06:53 +0000 (18:06 +0100)]
net, thunder, bgx: Rework driver to support ACPI binding.

Additional functionality aims to find out which PHYs belong to which
BGX instance in the ACPI way.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agonet, mdio, acpi: Add support for ACPI binding.
Tomasz Nowicki [Tue, 16 Dec 2014 17:01:34 +0000 (18:01 +0100)]
net, mdio, acpi: Add support for ACPI binding.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agopci domain: Factor out get_pci_domain_nr()
Robert Richter [Sun, 4 Jan 2015 17:37:22 +0000 (18:37 +0100)]
pci domain: Factor out get_pci_domain_nr()

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agopci domains: Fixing whitespace in pci_bus_assign_domain_nr()
Robert Richter [Sun, 4 Jan 2015 17:34:02 +0000 (18:34 +0100)]
pci domains: Fixing whitespace in pci_bus_assign_domain_nr()

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agonet, phy, apci: Allow to initialize Marvell phy in the ACPI way.
Tomasz Nowicki [Tue, 16 Dec 2014 17:02:39 +0000 (18:02 +0100)]
net, phy, apci: Allow to initialize Marvell phy in the ACPI way.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, pci: Add PCI ACPI probing for ARM64
Tomasz Nowicki [Thu, 27 Nov 2014 17:20:51 +0000 (18:20 +0100)]
arm64, pci: Add PCI ACPI probing for ARM64

Host driver is made in old fashion, it should be revisited once
new way of root bus creation get upstream.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, pci, acpi: Let ARM64 to use MMCONFIG PCI config space accessors.
Tomasz Nowicki [Fri, 14 Nov 2014 10:17:35 +0000 (11:17 +0100)]
arm64, pci, acpi: Let ARM64 to use MMCONFIG PCI config space accessors.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agopci, acpi: Share ACPI PCI config space accessors.
Tomasz Nowicki [Fri, 14 Nov 2014 10:01:16 +0000 (11:01 +0100)]
pci, acpi: Share ACPI PCI config space accessors.

MMCFG can be used perfectly for all architectures which support ACPI.
ACPI mandates MMCFG to describe PCI config space ranges which means
we should use MMCONFIG accessors by default.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agox86, acpi, pci: mmconfig_64.c becomes default implementation for arch agnostic low...
Tomasz Nowicki [Fri, 14 Nov 2014 09:05:36 +0000 (10:05 +0100)]
x86, acpi, pci: mmconfig_64.c becomes default implementation for arch agnostic low-level direct PCI config space accessors via MMCONFIG.

Note that x86 32bits machines still have its own low-level direct
PCI config space accessors.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agox86, acpi, pci: mmconfig_{32,64}.c code refactoring - remove code duplication.
Tomasz Nowicki [Thu, 13 Nov 2014 16:02:39 +0000 (17:02 +0100)]
x86, acpi, pci: mmconfig_{32,64}.c code refactoring - remove code duplication.

mmconfig_64.c version is going to be default implementation for arch
agnostic low-level direct PCI config space accessors via MMCONFIG.
However, now it initialize raw_pci_ext_ops pointer which is used in
x86 specific code only. Moreover, mmconfig_32.c is doing the same thing
at the same time.

Move it to mmconfig_shared.c so it becomes common for both and
mmconfig_64.c turns out to be purely arch agnostic.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agox86, acpi, pci: Move PCI config space accessors.
Tomasz Nowicki [Thu, 13 Nov 2014 14:48:24 +0000 (15:48 +0100)]
x86, acpi, pci: Move PCI config space accessors.

We are going to use mmio_config_{} name convention across all architectures.
Currently it belongs to asm/pci_x86.h header which should be included
only for x86 specific files. From now on, those accessors are in asm/pci.h
header which can be included in non-architecture code much easier.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agox86, acpi, pci: Move arch-agnostic MMCFG code out of arch/x86/ directory
Tomasz Nowicki [Thu, 13 Nov 2014 10:59:18 +0000 (11:59 +0100)]
x86, acpi, pci: Move arch-agnostic MMCFG code out of arch/x86/ directory

MMCFG table seems to be architecture independent and it makes sense
to share common code across all architectures. The ones that may need
architectural specific actions have default prototype (__weak).

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agox86, acpi, pci: Reorder logic of pci_mmconfig_insert() function
Tomasz Nowicki [Thu, 13 Nov 2014 10:54:53 +0000 (11:54 +0100)]
x86, acpi, pci: Reorder logic of pci_mmconfig_insert() function

This patch is the first step for MMCONFIG refactoring process.

Code that uses pci_mmcfg_lock will be moved to common file and become
accessible for all architectures. pci_mmconfig_insert() cannot be moved
so easily since it is mixing generic mmcfg code with x86 specific logic
inside of mutual exclusive block guarded by pci_mmcfg_lock.

To get rid of that constraint we reorder actions as fallow:
1. mmconfig entry allocation can be done at first, does not need lock
2. insertion to iomem_resource has its own lock, no need to wrap it into mutex
3. insertion to mmconfig list can be done as the final stage in separate
function (candidate for further factoring)

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoACPI, GICv3, ITS: Add support for ACPI ITS binding.
Tomasz Nowicki [Thu, 11 Sep 2014 10:33:09 +0000 (12:33 +0200)]
ACPI, GICv3, ITS: Add support for ACPI ITS binding.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoGICv3, ITS: Isolate FDT related code, extract common functions.
Tomasz Nowicki [Mon, 24 Nov 2014 17:53:53 +0000 (18:53 +0100)]
GICv3, ITS: Isolate FDT related code, extract common functions.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoACPI, GICV3+: Add support for GICv3+ initialization.
Tomasz Nowicki [Thu, 8 Jan 2015 11:38:34 +0000 (12:38 +0100)]
ACPI, GICV3+: Add support for GICv3+ initialization.

Obtain GICv3+ re-distributor base addresses from MADT subtable,
check data integrity and call GICv3 init funtion. GIC drivers probe order:
if MADT provides redistributors, try GICv3 driver, otherwise try GICv2.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoGICv3: Refactor gic_of_init() of GICv3 driver to allow for FDT and ACPI initialization.
Tomasz Nowicki [Wed, 21 May 2014 13:53:23 +0000 (15:53 +0200)]
GICv3: Refactor gic_of_init() of GICv3 driver to allow for FDT and ACPI initialization.

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.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoACPI, GICv3: Allow to map irq for non-hierarchical doamin.
Tomasz Nowicki [Thu, 27 Nov 2014 17:09:32 +0000 (18:09 +0100)]
ACPI, GICv3: Allow to map irq for non-hierarchical doamin.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, acpi: Implement new "GIC version" field of MADT GIC entry.
Tomasz Nowicki [Thu, 8 Jan 2015 11:36:33 +0000 (12:36 +0100)]
arm64, acpi: Implement new "GIC version" field of MADT GIC entry.

There is no need to probe GICv2 and GICv3 sequentially. From now on,
we know GIC version in advance. Note this patch does not break backward
compatibility for machines which are compliant with ACPI spec. 5.1.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoclocksource: arm_arch_timer: fix system hang
Al Stone [Tue, 11 Nov 2014 00:11:20 +0000 (17:11 -0700)]
clocksource: arm_arch_timer: fix system hang

Arm allows for two possible architectural clock sources. One memory mapped
and the other coprocessor based. If both timers exist, then the driver waits
for both to be probed before registering a clocksource.

Commit c387f07e6205 ("clocksource: arm_arch_timer: Discard unavailable timers
correctly") attempted to fix a hang occurring when one of the two possible
timers had a device node, but was disabled. In that case, the second probe
would never occur and the system would hang without a clocksource being
registered.

Unfortunately, incorrect logic in that commit made things worse such that
a hang would occur unless both timers had a device node and were enabled.
This patch fixes the logic so that we don't wait to probe a second timer
unless it exists and is enabled.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoFix arm64 compilation error in PNP code
Al Stone [Thu, 28 Aug 2014 17:14:16 +0000 (13:14 -0400)]
Fix arm64 compilation error in PNP code

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agomfd: vexpress-sysreg Add ACPI support for probing to driver
Naresh Bhat [Wed, 23 Oct 2013 11:23:31 +0000 (16:53 +0530)]
mfd: vexpress-sysreg Add ACPI support for probing to driver

Add match table and pointers for ACPI probing into vexpress-sysreg driver.

vexpress-sysreg is self-contained so it gets resources automatically
being platform driver. However, while it is not probed, it still should
provides base address so that other related drivers can take advantage
of it. Make it possible and find resources based on device HID.

Signed-off-by: Naresh Bhat <naresh.bhat@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoRevert "mfd: vexpress: Remove non-DT code"
Robert Richter [Tue, 23 Jun 2015 10:17:37 +0000 (12:17 +0200)]
Revert "mfd: vexpress: Remove non-DT code"

This reverts commit f0bd7ccc413f6de0947d6b8e998ef1fb787513ff.

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agovirtio-mmio: add ACPI probing
Graeme Gregory [Fri, 26 Jul 2013 16:55:02 +0000 (17:55 +0100)]
virtio-mmio: add ACPI probing

Added the match table and pointers for ACPI probing to the driver.

Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agonet: smc91x: add ACPI probing support.
Graeme Gregory [Wed, 24 Jul 2013 10:29:48 +0000 (11:29 +0100)]
net: smc91x: add ACPI probing support.

Add device ID LINA0003 for this device and add the match table.

As its a platform device it needs no other code and will be probed in by
acpi_platform once device ID is added.

Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoJuno / net: smsc911x add support for probing from ACPI
Graeme Gregory [Mon, 30 Jun 2014 18:52:02 +0000 (19:52 +0100)]
Juno / net: smsc911x add support for probing from ACPI

This is a standard platform device to resources are converted in the
ACPI core in the same fasion as DT resources. For the other DT
provided information there is _DSD for ACPI.

Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoDTS: Increase default memory to 15 GB
Tirumalesh Chalamarla [Tue, 18 Nov 2014 01:06:29 +0000 (17:06 -0800)]
DTS: Increase default memory to 15 GB

Increase default system meory to 15GB.

Signed-off-by: Tirumalesh Chalamarla <tchalamarla@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoedac: Add Cavium ThunderX CCPI EDAC driver
Sergey Temerkhanov [Thu, 28 May 2015 05:34:03 +0000 (22:34 -0700)]
edac: Add Cavium ThunderX CCPI EDAC driver

Add support for Cavium ThunderX SoC CCPI EDAC driver.

Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@auriga.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoedac: Add Cavium ThunderX LMC EDAC driver
Sergey Temerkhanov [Thu, 28 May 2015 05:28:55 +0000 (22:28 -0700)]
edac: Add Cavium ThunderX LMC EDAC driver

Add support for Cavium ThunderX SoC LMC EDAC driver.

Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@auriga.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64: Add atomic_scrub function for EDAC
Sergey Temerkhanov [Thu, 28 May 2015 04:14:51 +0000 (21:14 -0700)]
arm64: Add atomic_scrub function for EDAC

Add an atomic_scrub function for EDAC on arm64.

Discussions on why this function is made a no-op is here.
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/326986.html

Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64: Increase the max granular size
TIRUMALESH CHALAMARLA [Wed, 12 Nov 2014 23:15:04 +0000 (18:15 -0500)]
arm64: Increase the max granular size

Signed-off-by: TIRUMALESH CHALAMARLA <tchalamarla@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64: optimized copy_to_user and copy_from_user assembly code, part 2
Craig Magina [Fri, 1 Aug 2014 23:36:00 +0000 (16:36 -0700)]
arm64: optimized copy_to_user and copy_from_user assembly code, part 2

Using the glibc cortex string work work authored by Linaro as base to
create new copy to/from user kernel routine.

Iperf performance increase:
-l (size) 1 core result
Optimized  64B 44-51Mb/s
1500B 4.9Gb/s
30000B 16.2Gb/s
Original 64B 34-50.7Mb/s
1500B 4.7Gb/s
30000B 14.5Gb/s

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1400349
Note there was one change I did to move around tst to be right next to
the branch for better optimization for ThunderX.

Signed-off-by: Craig Magina <craig.magina@canonical.com>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64: optimized copy_to_user and copy_from_user assembly code
Feng Kan [Fri, 1 Aug 2014 23:36:00 +0000 (16:36 -0700)]
arm64: optimized copy_to_user and copy_from_user assembly code

Using the glibc cortex string work work authored by Linaro as base to
create new copy to/from user kernel routine.

Iperf performance increase:
-l (size) 1 core result
Optimized  64B 44-51Mb/s
1500B 4.9Gb/s
30000B 16.2Gb/s
Original 64B 34-50.7Mb/s
1500B 4.7Gb/s
30000B 14.5Gb/s

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1400349
Signed-off-by: Feng Kan <fkan@apm.com>
Signed-off-by: Craig Magina <craig.magina@canonical.com>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64: Improve copy_page for 128 cache line sizes.
Andrew Pinski [Sat, 21 Mar 2015 20:08:01 +0000 (13:08 -0700)]
ARM64: Improve copy_page for 128 cache line sizes.

Adding a check for the cache line size is not much overhead.
Special case 128 byte cache line size.
This improves copy_page by 85% on ThunderX compared to the
original implementation.

For LMBench, it improves between 4-10%.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64:spinlocks: Fix up for WFE and improve performance slightly.
Andrew Pinski [Sat, 21 Mar 2015 01:55:27 +0000 (18:55 -0700)]
ARM64:spinlocks: Fix up for WFE and improve performance slightly.

In the previous patch, I had made a mistake of putting WFE after the delay which
meant if we enable the WFE, we would get the same bad performance as before.
Also use the flags register some more to allow the instructions to be fused together.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64:Improve ticked spinlocks for high core count.
Andrew Pinski [Tue, 17 Mar 2015 23:01:55 +0000 (16:01 -0700)]
ARM64:Improve ticked spinlocks for high core count.

For high core counts, we want to add a delay when current
serving tick is "far" away from our ticket.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64:VDSO: Improve __do_get_tspec, don't use udiv
Andrew Pinski [Thu, 5 Mar 2015 09:40:11 +0000 (01:40 -0800)]
ARM64:VDSO: Improve __do_get_tspec, don't use udiv

In most other targets (x86/tile for an example),
the division in __do_get_tspec is converted into
a simple loop.  The main reason for this is
because the result of this division is going
to be either 0 or 1.
This changes the division to the simple loop
and thus speeding up gettimeofday.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoARM64:VDSO: Improve gettimeofday, don't use udiv
Andrew Pinski [Thu, 5 Mar 2015 07:50:49 +0000 (23:50 -0800)]
ARM64:VDSO: Improve gettimeofday, don't use udiv

On some cores, udiv with a large value is slow, expand instead
the division out to be what GCC would have generated for the
divide by 1000.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoirqchip, gicv3-its, numa: Workaround for Cavium ThunderX erratum 23144
Ganapatrao Kulkarni [Wed, 19 Aug 2015 18:10:05 +0000 (23:40 +0530)]
irqchip, gicv3-its, numa: Workaround for Cavium ThunderX erratum 23144

This implements a workaround for gicv3-its erratum 23144 applicable
for Cavium's ThunderX multinode systems.

The erratum fixes the hang of ITS SYNC command by avoiding inter node
io and collections/cpu mapping. This fix is only applicable for
Cavium's ThunderX dual-socket platforms.

Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
[ rric: Reworked errata code, added helper functions, updated commit
   message. ]

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, dt, thunderx: Add initial dts for Cavium Thunder SoC in 2 Node topology.
Ganapatrao Kulkarni [Thu, 13 Aug 2015 12:21:52 +0000 (17:51 +0530)]
arm64, dt, thunderx: Add initial dts for Cavium Thunder SoC in 2 Node topology.

adding dt file for Cavium's Thunder SoC in 2 Node topology
using arm,associativity device node property.

Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, numa: adding numa support for arm64 platforms.
Ganapatrao Kulkarni [Fri, 14 Aug 2015 16:17:20 +0000 (21:47 +0530)]
arm64, numa: adding numa support for arm64 platforms.

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.

Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoDocumentation: arm64/arm: dt bindings for numa.
Ganapatrao Kulkarni [Tue, 13 Jan 2015 16:34:36 +0000 (22:04 +0530)]
Documentation: arm64/arm: dt bindings for numa.

DT bindings for numa map for memory, cores and IOs using
arm,associativity device node property.

Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64, numa: adding numa support for arm64 platforms.
Ganapatrao Kulkarni [Fri, 14 Aug 2015 15:51:05 +0000 (21:21 +0530)]
arm64, numa: adding numa support for arm64 platforms.

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.

Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64/efi: adapt to relaxed FDT placement requirements
Ard Biesheuvel [Mon, 2 Mar 2015 18:10:07 +0000 (18:10 +0000)]
arm64/efi: adapt to relaxed FDT placement requirements

With the relaxed FDT placement requirements in place, we can change
the allocation strategy used by the stub to put the FDT image higher
up in memory. At the same time, reduce the minimal alignment to 8 bytes,
and impose a 2 MB size limit, as per the new requirements.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64/efi: ignore DT memreserve entries instead of removing them
Ard Biesheuvel [Sun, 10 May 2015 06:41:31 +0000 (08:41 +0200)]
arm64/efi: ignore DT memreserve entries instead of removing them

Now that the reservation of the FDT image itself is split off, we
can make the DT scanning of memreserves conditional on whether we
booted via UEFI and have its memory map available. This allows us
to drop deletion of these memreserves in the stub. It also fixes
the issue where the /reserved-memory/ node (which offers another
way of reserving memory ranges) was not being ignored under UEFI.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64/efi: ignore DT memory nodes instead of removing them
Ard Biesheuvel [Sun, 10 May 2015 08:26:44 +0000 (10:26 +0200)]
arm64/efi: ignore DT memory nodes instead of removing them

There are two problems with the UEFI stub DT memory node removal
routine:
- it deletes nodes as it traverses the tree, which happens to work
  but is not supported, as deletion invalidates the node iterator;
- deleting memory nodes entirely may discard annotations in the form
  of additional properties on the nodes.

Now that the UEFI initialization has moved to an earlier stage, we can
actually just ignore any memblocks that are installed after we have
processed the UEFI memory map. This way, it is no longer necessary to
remove the nodes, so we can remove that logic from the stub as well.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoarm64/efi: move EFI init before early FDT processing
Ard Biesheuvel [Sun, 10 May 2015 12:03:31 +0000 (14:03 +0200)]
arm64/efi: move EFI init before early FDT processing

The early FDT processing is responsible for enumerating the
DT memory nodes and installing them as memblocks. This should
only be done if we are not booting via EFI, but at this point,
we don't know yet if that is the case or not.

So move the EFI init to before the early FDT processing. This involves
making some changes to the way EFI discovers the locations of the
EFI system table and the memory map, since those values are retrieved
from the FDT as well. Instead the of_scan infrastructure, it now uses
libfdt directly to access the /chosen node.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
9 years agoefi: move FDT handling to separate object file
Ard Biesheuvel [Sun, 10 May 2015 10:09:14 +0000 (12:09 +0200)]
efi: move FDT handling to separate object file

The EFI specific FDT handling is compiled conditionally, and is
logically independent of the rest of efi.o. So move it to a separate
file before making changes to it in subsequent patches.

Acked-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>