xen/arm: Data abort exception (R/W) mem_events.

This patch enables to store, set, check and deliver LPAE R/W mem_events.

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
---
v4: - Add p2m_mem_access_radix_set function to be called
      when inserting new PTE's and when updating existing entries.
v3: - Add new function for updating the PTE entries, p2m_set_entry.
    - Use the new struct npfec to pass violation information.
    - Implement n2rwx, rx2rw and listener required routines.

v2: - Patch been split to ease the review process.
    - Add definitions of data abort data fetch status codes (enum dabt_dfsc)
      and only call p2m_mem_access_check for traps caused by permission violations.
    - Only call p2m_write_pte in p2m_lookup if the PTE permission actually changed.
    - Properly save settings in the Radix tree and pause the VCPU with
      mem_event_vcpu_pause.
xen/arm: Instruction prefetch abort (X) mem_event handling

Add missing structure definition for iabt and update the trap handling
mechanism to only inject the exception if the mem_access checker
decides to do so.

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
---
v2: Add definition for instruction abort instruction fetch status codes (enum iabt_ifsc)
       and only call p2m_mem_access_check for traps triggered for permission violations.
xen/arm: Shatter large pages when using mem_acces

When using mem_acccess+mem_event, the coarsest granularity is required
in the pagetables, therefore we shatter each large page (1GB/2MB) as we
apply the permission changes.

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
xen/arm: Enable the compilation of mem_access and mem_event on ARM.

This patch sets up the infrastructure to support mem_access and mem_event
on ARM and turns on compilation. We define the required XSM functions.

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
---
v3: Wrap mem_event related functions in XSM into #ifdef HAS_MEM_ACCESS
       blocks.
    Update XSM hooks in flask to properly wire it up on ARM.

v2: Add CONFIG_MEM_PAGING and CONFIG_MEM_SHARING definitions and
       use them instead of CONFIG_X86.
    Split domctl copy-back and p2m type definitions into separate
       patches and move this patch to the end of the series.
tools/libxc: Allocate magic page for mem access on ARM

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
tools/tests: Enable xen-access on ARM

On ARM the guest memory doesn't start from 0, thus we include the
required headers and define GUEST_RAM_BASE_PFN in both architecture
to be passed to mem_access as the starting pfn.
We also define the ARM specific test_and_set_bit function.

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
---
v4: Take into account multiple guest ram banks on ARM.
    Build only if CONFIG_X86/CONFIG_ARM is defined.