Re: [Xen-devel] [PATCH 2/2] xen/arm: smmu: Parse generic iommu binding for PCI devices

2017-07-07 Thread Wei Chen
Hi Stefano, > -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月7日 5:05 > To: Wei Chen <wei.c...@arm.com> > Cc: xen-devel@lists.xen.org; sstabell...@kernel.org; Julien Grall > <julien.gr...@arm.com>; Steve Capper &l

Re: [Xen-devel] [PATCH 1/2] xen: devicetree: Introduce a helper to translate PCI requester ID

2017-07-06 Thread Wei Chen
Hi Stefano, > -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月7日 4:26 > To: Wei Chen <wei.c...@arm.com> > Cc: xen-devel@lists.xen.org; sstabell...@kernel.org; Julien Grall > <julien.gr...@arm.com>; Steve Capper &l

Re: [Xen-devel] [PATCH 6/7] xen/arm: SMMU: Support generic IOMMU bindings

2017-07-05 Thread Wei Chen
> -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月6日 2:15 > To: Wei Chen <wei.c...@arm.com> > Cc: Julien Grall <julien.gr...@arm.com>; Stefano Stabellini > <sstabell...@kernel.org>; Kaly Xin <kaly...

Re: [Xen-devel] [PATCH 4/7] xen/arm: SMMU: Detect types of device tree binding

2017-07-05 Thread Wei Chen
> -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月6日 2:08 > To: Wei Chen <wei.c...@arm.com> > Cc: Stefano Stabellini <sstabell...@kernel.org>; Kaly Xin <kaly@arm.com>; > Julien Grall <julien.

Re: [Xen-devel] [PATCH 2/7] xen/arm: SMMU: Introduce a helper to add DT device to SMMU

2017-07-05 Thread Wei Chen
> -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月6日 2:02 > To: Wei Chen <wei.c...@arm.com> > Cc: Stefano Stabellini <sstabell...@kernel.org>; Kaly Xin <kaly@arm.com>; > Julien Grall <julien.

Re: [Xen-devel] [PATCH 1/7] xen/arm: SMMU: Implement the add_device callback in SMMU

2017-07-05 Thread Wei Chen
> -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月6日 1:58 > To: Wei Chen <wei.c...@arm.com> > Cc: Stefano Stabellini <sstabell...@kernel.org>; xen-devel@lists.xen.org; > Steve Capper <steve.cap...@arm.com>;

Re: [Xen-devel] [PATCH 6/7] xen/arm: SMMU: Support generic IOMMU bindings

2017-07-05 Thread Wei Chen
Hi Julien, > -Original Message- > From: Julien Grall [mailto:julien.gr...@arm.com] > Sent: 2017年7月5日 21:08 > To: Wei Chen <wei.c...@arm.com>; Stefano Stabellini <sstabell...@kernel.org> > Cc: xen-devel@lists.xen.org; Steve Capper <steve.cap...@arm.com>;

Re: [Xen-devel] [PATCH 1/7] xen/arm: SMMU: Implement the add_device callback in SMMU

2017-07-05 Thread Wei Chen
Hi Julien, > -Original Message- > From: Julien Grall [mailto:julien.gr...@arm.com] > Sent: 2017年7月4日 23:41 > To: Wei Chen <wei.c...@arm.com>; xen-devel@lists.xen.org > Cc: sstabell...@kernel.org; Steve Capper <steve.cap...@arm.com>; Kaly Xin > <ka

Re: [Xen-devel] [PATCH 6/7] xen/arm: SMMU: Support generic IOMMU bindings

2017-07-05 Thread Wei Chen
Hi Julien, > -Original Message- > From: Julien Grall [mailto:julien.gr...@arm.com] > Sent: 2017年7月4日 15:27 > To: Wei Chen <wei.c...@arm.com>; Stefano Stabellini <sstabell...@kernel.org> > Cc: xen-devel@lists.xen.org; Steve Capper <steve.cap...@arm.com>;

Re: [Xen-devel] [PATCH 6/7] xen/arm: SMMU: Support generic IOMMU bindings

2017-07-04 Thread Wei Chen
Hi Stefano, > -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月4日 7:00 > To: Wei Chen <wei.c...@arm.com> > Cc: xen-devel@lists.xen.org; sstabell...@kernel.org; Steve Capper > <steve.cap...@arm.com>; Kaly Xin &l

Re: [Xen-devel] [PATCH 4/7] xen/arm: SMMU: Detect types of device tree binding

2017-07-04 Thread Wei Chen
Hi Stefano, > -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月4日 6:30 > To: Wei Chen <wei.c...@arm.com> > Cc: xen-devel@lists.xen.org; sstabell...@kernel.org; Steve Capper > <steve.cap...@arm.com>; Kaly Xin &l

Re: [Xen-devel] [PATCH 2/7] xen/arm: SMMU: Introduce a helper to add DT device to SMMU

2017-07-03 Thread Wei Chen
Hi Stefano, > -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月4日 6:03 > To: Wei Chen <wei.c...@arm.com> > Cc: xen-devel@lists.xen.org; sstabell...@kernel.org; Steve Capper > <steve.cap...@arm.com>; Kaly Xin &l

Re: [Xen-devel] [PATCH 1/7] xen/arm: SMMU: Implement the add_device callback in SMMU

2017-07-03 Thread Wei Chen
Hi Stefano, > -Original Message- > From: Stefano Stabellini [mailto:sstabell...@kernel.org] > Sent: 2017年7月4日 5:58 > To: Wei Chen <wei.c...@arm.com> > Cc: xen-devel@lists.xen.org; sstabell...@kernel.org; Steve Capper > <steve.cap...@arm.com>; Kaly Xin &l

[Xen-devel] [PATCH 0/2] Add support parse PCI iommu bindings for Xen SMMU

2017-06-29 Thread Wei Chen
The legacy IOMMU bindings will be deprecated in future. Instead, device tree provide generic IOMMU bindings and PCI IOMMU bindings. Currently, the PCI support hasn't been enabled on ARM Xen. So in this series, we just add the support of parsing PCI IOMMU bindings. Wei Chen (2): xen: devicetree

[Xen-devel] [PATCH 1/2] xen: devicetree: Introduce a helper to translate PCI requester ID

2017-06-29 Thread Wei Chen
://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/of/of_pci.c The commit id is: 987068fcbdb7a085bb11151b91dc6f4c956c4a1b Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/common/device_tree.c | 89 +++ xen/include/xen/device_

[Xen-devel] [PATCH 2/2] xen/arm: smmu: Parse generic iommu binding for PCI devices

2017-06-29 Thread Wei Chen
This patch is based on Linux of_iommu.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/of_iommu.c The commit id is: 2a0c57545a291f257cd231b1c4b18285b84608d8 Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough

[Xen-devel] [PATCH 4/7] xen/arm: SMMU: Detect types of device tree binding

2017-06-29 Thread Wei Chen
we have to detect the binding types while doing SMMU probing. This detect code is based on Linux ARM SMMUv2 driver: https://github.com/torvalds/linux/blob/master/drivers/iommu/arm-smmu.c Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough/arm/smmu.

[Xen-devel] [PATCH 1/7] xen/arm: SMMU: Implement the add_device callback in SMMU

2017-06-29 Thread Wei Chen
. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough/arm/smmu.c | 34 +++--- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index 74c09b0..2efa52d

[Xen-devel] [PATCH 6/7] xen/arm: SMMU: Support generic IOMMU bindings

2017-06-29 Thread Wei Chen
their master devices. It's better to register SMMU master for generic bindings in add_device callback. This callback will only be called while constructing Dom0. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough/arm/smmu.c | 144 - 1 file c

[Xen-devel] [PATCH 2/7] xen/arm: SMMU: Introduce a helper to add DT device to SMMU

2017-06-29 Thread Wei Chen
preparation for further use. In this case, we can't call iommu_assign_dt_device. In previous patch, we have implement the add_device callback for SMMU, so we can separate this work from assign_device now. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough/device_tree.

[Xen-devel] [PATCH 3/7] xen/arm: Prepare SMMU resources for protected devices

2017-06-29 Thread Wei Chen
protected devices, regardless of passthrough or not. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/arch/arm/domain_build.c | 12 1 file changed, 12 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c6776d7..6aea427 100644 --- a/xen/ar

[Xen-devel] [PATCH 7/7] xen: Fix a typo in error message of iommu_do_dt_domctl

2017-06-29 Thread Wei Chen
It's a error message about XEN_DOMCTL_deassign_device, but the print message is XEN_DOMCTL_assign_device. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough/device_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passt

[Xen-devel] [PATCH 0/7] Generic IOMMU bindings support for Xen platform devices

2017-06-29 Thread Wei Chen
ron server. The platform device can be passthrough to guest with both Legacy and Generic IOMMU bindings. I noticed that Sameer has a iommu_fwspec series in review. It would be nice to look at it and see if we can re-use it in this series. Wei Chen (7): xen/arm: SMMU: Implement the add_device callback in SMMU

[Xen-devel] [PATCH 5/7] xen/arm: SMMU: Keep registering legacy master in SMMU probe

2017-06-29 Thread Wei Chen
legacy master in SMMU probing. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/drivers/passthrough/arm/smmu.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c

[Xen-devel] [PATCH v2] xen/arm32: Distinguish guest SError from Xen data aborts

2017-05-03 Thread Wei Chen
So we want to change the policy to handle data aborts for ARM32: 1. If this data abort is guest generated SError, we will handle this data abort follow the SError handle option setting. 2. If this data abort is synchronous data abort or Xen generate SError, we will PANIC the whole system. Signed-o

Re: [Xen-devel] [PATCH] xen/arm32: Distinguish guest SError from Xen data aborts

2017-05-03 Thread Wei Chen
Hi Stefano, On 2017/5/4 5:56, Stefano Stabellini wrote: > On Wed, 3 May 2017, Wei Chen wrote: >> ARM32 doesn't have an exception similar to hyp_sync of ARM64 to catch >> the synchronous data abort (For example, a NULL pointer has been referenced). >> Hence the SErro

[Xen-devel] [PATCH] xen/arm32: Distinguish guest SError from Xen data aborts

2017-05-02 Thread Wei Chen
So we want to change the policy to handle data aborts for ARM32: 1. If this data abort is guest generated SError, we will handle this data abort follow the SError handle option setting. 2. If this data abort is synchronous data abort or Xen generate SError, we will PANIC the whole system. Signed-o

Re: [Xen-devel] [PATCH v4 00/19] Provide a command line option to choose how to handle SErrors

2017-04-05 Thread Wei Chen
Thanks to you and Julien :) On 2017/4/6 3:18, Stefano Stabellini wrote: > Thank you Wei. I committed this series. I fixed on commit patch #16 that > has 2 asserts. > > On Wed, 5 Apr 2017, Wei Chen wrote: >> From XSA-201, we know that, a guest could trigger SErrors when a

[Xen-devel] [PATCH v4 17/19] xen/arm: Isolate the SError between the context switch of 2 vCPUs

2017-04-05 Thread Wei Chen
es. Because we have umasked the Abort/SError bit in previous patch, we have to disable Abort/SError before doing context switch as we have done for IRQ. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Julien Grall <julien.gr...@arm.com> Reviewed-by: Stefano Stabellini <ss

[Xen-devel] [PATCH v4 19/19] xen/arm: Handle guest external abort as guest SError

2017-04-05 Thread Wei Chen
The guest generated external data/instruction aborts can be treated as guest SErrors. We already have a handler to handle the SErrors, so we can reuse this handler to handle guest external aborts. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@k

[Xen-devel] [PATCH v4 01/19] xen/arm: Save ESR_EL2 to avoid using mismatched value in syndrome check

2017-04-05 Thread Wei Chen
to restore ELR and CPSR from stack at the same time. We have to use ldr to restore them separately. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Julien Grall <julien.gr...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/arm32/asm-offsets.

[Xen-devel] [PATCH v4 18/19] xen/arm: Prevent slipping hypervisor SError to guest

2017-04-05 Thread Wei Chen
. We have to disable the Abort/SError before returning to guest as we have done for IRQ. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/arch/arm/traps.c | 13 + 1 file changed, 13 insertions(+) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index c092e66..c8163db

[Xen-devel] [PATCH v4 15/19] xen/arm: Introduce a helper to check local abort is enabled

2017-04-05 Thread Wei Chen
SErrors is pointless. Signed-off-by: Wei Chen <wei.c...@arm.com> --- v3->v4: Use one local_abort_is_enabled for ARM32 and ARM64. --- xen/include/asm-arm/system.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h inde

[Xen-devel] [PATCH v4 16/19] xen/arm: Introduce a macro to synchronize SError

2017-04-05 Thread Wei Chen
compiler reorder our asm volatile code. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/include/asm-arm/processor.h | 13 + 1 file changed, 13 insertions(+) diff --git a/xen/include/asm-arm/processor.h b/xen/i

[Xen-devel] [PATCH v4 10/19] xen/arm32: Use alternative to skip the check of pending serrors

2017-04-05 Thread Wei Chen
. The ARM32 supports the alternative patching feature. We can use an ALTERNATIVE to avoid checking option at every trap. We added a new cpufeature named "SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT". This feature will be enabled when the option is not diverse. Signed-off-by: Wei Chen <wei.c...@arm.

[Xen-devel] [PATCH v4 07/19] xen/arm: Introduce a command line parameter for SErrors/Aborts

2017-04-05 Thread Wei Chen
ll avoid all overhead of the dsb/isb pairs. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- docs/misc/xen-command-line.markdown | 44 + xen/arch/arm/traps.c| 19 +

[Xen-devel] [PATCH v4 12/19] xen/arm: Introduce new helpers to handle guest/hyp SErrors

2017-04-05 Thread Wei Chen
, that would be a bug. In the new helpers, we have used the function "inject_vabt_exception" which was disabled by "#if 0" before. Now, we can remove the "#if 0" to make this function to be available. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefan

[Xen-devel] [PATCH v4 08/19] xen/arm: Introduce a initcall to update cpu_hwcaps by serror_op

2017-04-05 Thread Wei Chen
ult option will be diverse today, this may change in the future. So we introduce this initcall to guarantee the cpu_hwcaps can be updated no matter the serror parameter is placed in the command line or not. Signed-off-by: Wei Chen <wei.c...@arm.com> Acked-by: Julien Grall <julien.gr...@arm.com>

[Xen-devel] [PATCH v4 02/19] xen/arm: Introduce a helper to get default HCR_EL2 flags

2017-04-05 Thread Wei Chen
We want to add HCR_EL2 register to Xen context switch. And each copy of HCR_EL2 in vcpu structure will be initialized with the same set of trap flags as the HCR_EL2 register. We introduce a helper here to represent these flags to be reused easily. Signed-off-by: Wei Chen <wei.c...@arm.

[Xen-devel] [PATCH v4 00/19] Provide a command line option to choose how to handle SErrors

2017-04-05 Thread Wei Chen
DING_VSERROR to SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT. 2. Add ASSERT in SYNCHRONIZING_SERROR macro to ensure abort is enabled. 3. Use one local_abort_is_enabled for ARM32 and ARM64. 4. Fix some grammer issues. 5. Add Reviewed-by tags from Julien and Stefano for most of this series. Wei Chen (19): x

[Xen-devel] [PATCH v4 14/19] xen/arm: Unmask the Abort/SError bit in the exception entries

2017-04-05 Thread Wei Chen
to avoid receiving nested asynchronous abort, we don't unmask Abort/SError bit in hyp_error and trap_data_abort. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/arm32/entry.S | 15 ++- xen/arch/arm/arm64/

[Xen-devel] [PATCH v4 04/19] xen/arm: Avoid setting/clearing HCR_RW at every context switch

2017-04-05 Thread Wei Chen
. Signed-off-by: Wei Chen <wei.c...@arm.com> Acked-by: Julien Grall <julien.gr...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/arm64/domctl.c | 6 ++ xen/arch/arm/domain.c| 5 + xen/arch/arm/domain_build.c | 7 +++

[Xen-devel] [PATCH v4 09/19] xen/arm64: Use alternative to skip the check of pending serrors

2017-04-05 Thread Wei Chen
. The ARM64 supports the alternative patching feature. We can use an ALTERNATIVE to avoid checking option at every trap. We added a new cpufeature named "SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT". This feature will be enabled when the option is not diverse. Signed-off-by: Wei Chen <wei.c...@arm.

[Xen-devel] [PATCH v4 11/19] xen/arm: Move macro VABORT_GEN_BY_GUEST to common header

2017-04-05 Thread Wei Chen
abort_guest_exit_start and abort_guest_exit_end. After we move this macro to a common header, we need to make sure that the two symbols are visible to other source files. Currently, they are declared .global in arm32/entry.S, but not arm64/entry.S. Fix that. Signed-off-by: Wei Chen <wei.c...@arm.com> Re

[Xen-devel] [PATCH v4 06/19] xen/arm: Introduce a virtual abort injection helper

2017-04-05 Thread Wei Chen
#if 0 to disable it in this patch temporarily to remove the warning message of unused function from compiler. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> Reviewed-by: Julien Grall <julien.gr...@arm.com> --- xe

[Xen-devel] [PATCH v4 05/19] xen/arm: Save HCR_EL2 when a guest took the SError

2017-04-05 Thread Wei Chen
to restore it to HCR_EL2 when context switch to this guest. This is achieved by writing saved HCR_EL2 value in guest context back to HCR_EL2 register before return to guest. This had been done by the patch of "Restore HCR_EL2 register". Signed-off-by: Wei Chen <wei.c...@arm.com> Revi

[Xen-devel] [PATCH v4 03/19] xen/arm: Set and restore HCR_EL2 register for each vCPU separately

2017-04-05 Thread Wei Chen
to restore the HCR_EL2 for each vCPU. Of course, the value of each vCPU's HCR_EL2 should be adjusted to have proper HCR_EL2.RW bit in this function. In the later patch of this series, we will set the HCR_EL2.RW for each vCPU while the domain is creating. Signed-off-by: wei chen <wei.c...@arm.com> Re

Re: [Xen-devel] [PATCH v3 16/19] xen/arm: Introduce a macro to synchronize SError

2017-04-05 Thread Wei Chen
Hi Julien, On 2017/4/5 16:20, Julien Grall wrote: On 05/04/2017 09:08, Wei Chen wrote: Hi Julien, On 2017/4/5 15:29, Julien Grall wrote: On 05/04/2017 08:14, Wei Chen wrote: Because the ASSERT I suggested was wrong, sorry for that. It should have been: ASSERT(!cpus_have_cap(feat

Re: [Xen-devel] [PATCH v3 16/19] xen/arm: Introduce a macro to synchronize SError

2017-04-05 Thread Wei Chen
Hi Julien, On 2017/4/5 15:29, Julien Grall wrote: On 05/04/2017 08:14, Wei Chen wrote: Because the ASSERT I suggested was wrong, sorry for that. It should have been: ASSERT(!cpus_have_cap(feat) && local_abort_is_enabled()); This is because we want abort enabled when the

Re: [Xen-devel] [PATCH v3 16/19] xen/arm: Introduce a macro to synchronize SError

2017-04-05 Thread Wei Chen
On 2017/4/5 15:29, Julien Grall wrote: On 05/04/2017 08:14, Wei Chen wrote: Because the ASSERT I suggested was wrong, sorry for that. It should have been: ASSERT(!cpus_have_cap(feat) && local_abort_is_enabled()); This is because we want abort enabled when the "feature&qu

Re: [Xen-devel] [PATCH v3 18/19] xen/arm: Prevent slipping hypervisor SError to guest

2017-04-05 Thread Wei Chen
On 2017/4/1 2:43, Julien Grall wrote: Hi Stefano, On 03/31/2017 07:42 PM, Stefano Stabellini wrote: On Fri, 31 Mar 2017, Julien Grall wrote: Hi Wei, On 31/03/17 14:07, Wei Chen wrote: If there is a pending SError while we're returning from trap. If the SError handle option is "DIVERSE

Re: [Xen-devel] [PATCH v3 16/19] xen/arm: Introduce a macro to synchronize SError

2017-04-05 Thread Wei Chen
Hi Julien, On 2017/3/31 22:33, Julien Grall wrote: Hi Wei, On 31/03/17 14:07, Wei Chen wrote: In previous patches, we have provided the ability to synchronize SErrors in exception entries. But we haven't synchronized SErrors while returning to guest and doing context switch. So we still have

Re: [Xen-devel] [PATCH v3 08/19] xen/arm: Introduce a initcall to update cpu_hwcaps by serror_op

2017-04-05 Thread Wei Chen
Hi Julien, On 2017/3/31 22:48, Julien Grall wrote: Hi Wei, On 31/03/17 14:07, Wei Chen wrote: In the later patches of this series, we want to use the alternative patching framework to avoid checking serror_op in every entries. So we define a new cpu feature "SKIP_CHECK_PENDING_VS

[Xen-devel] [PATCH v3 16/19] xen/arm: Introduce a macro to synchronize SError

2017-03-31 Thread Wei Chen
macro to synchronize SErrors while returning to guest and doing context switch. We also added a barrier to this macro to prevent compiler reorder our asm volatile code. Signed-off-by: Wei Chen <wei.c...@arm.com> --- v2->v3: 1. Use a macro to replace function to synchronize SErrors. 2.

[Xen-devel] [PATCH v3 17/19] xen/arm: Isolate the SError between the context switch of 2 vCPUs

2017-03-31 Thread Wei Chen
es. Because we have umasked the Abort/SError bit in previous patch, we have to disable Abort/SError before doing context switch as we have done for IRQ. Signed-off-by: Wei Chen <wei.c...@arm.com> --- v2->v3: 1. Use the macro instead of the function to synchronize SErrors. 2. Disable Abor

[Xen-devel] [PATCH v3 15/19] xen/arm: Introduce a helper to check local abort is enabled

2017-03-31 Thread Wei Chen
SErrors is pointless. Signed-off-by: Wei Chen <wei.c...@arm.com> --- xen/include/asm-arm/arm32/system.h | 7 +++ xen/include/asm-arm/arm64/system.h | 7 +++ 2 files changed, 14 insertions(+) diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/asm-arm/arm32/system.h index c

[Xen-devel] [PATCH v3 19/19] xen/arm: Handle guest external abort as guest SError

2017-03-31 Thread Wei Chen
The guest generated external data/instruction aborts can be treated as guest SErrors. We already have a handler to handle the SErrors, so we can reuse this handler to handle guest external aborts. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@k

[Xen-devel] [PATCH v3 14/19] xen/arm: Unmask the Abort/SError bit in the exception entries

2017-03-31 Thread Wei Chen
to avoid receiving nested asynchronous abort, we don't unmask Abort/SError bit in hyp_error and trap_data_abort. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/arm32/entry.S | 15 ++- xen/arch/arm/arm64/

[Xen-devel] [PATCH v3 18/19] xen/arm: Prevent slipping hypervisor SError to guest

2017-03-31 Thread Wei Chen
to disable the Abort/SError before returning to guest as we have done for IRQ. Signed-off-by: Wei Chen <wei.c...@arm.com> --- v2->v3: 1. Use alternative instead of check serror_op to skip sychronizing SErrors while option is NOT "DIVERSE". 2. Disable Abort/SError before return

[Xen-devel] [PATCH v3 07/19] xen/arm: Introduce a command line parameter for SErrors/Aborts

2017-03-31 Thread Wei Chen
ll avoid all overhead of the dsb/isb pairs. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- v2->v3: 1. Replace "entries" to "entries and exits" in commit message and doc. because all options will take effec

[Xen-devel] [PATCH v3 10/19] xen/arm32: Use alternative to skip the check of pending serrors

2017-03-31 Thread Wei Chen
. The ARM32 supports the alternative patching feature. We can use an ALTERNATIVE to avoid checking option at every trap. We added a new cpufeature named "SKIP_CHECK_PENDING_VSERROR". This feature will be enabled when the option is not diverse. Signed-off-by: Wei Chen <wei.c...@arm.com> Rev

[Xen-devel] [PATCH v3 11/19] xen/arm: Move macro VABORT_GEN_BY_GUEST to common header

2017-03-31 Thread Wei Chen
abort_guest_exit_start and abort_guest_exit_end. After we move this macro to a common header, we need to make sure that the two symbols are visible to other source files. Currently, they are declared .global in arm32/entry.S, but not arm64/entry.S. Fix that. Signed-off-by: Wei Chen <wei.c...@arm.com> Re

[Xen-devel] [PATCH v3 06/19] xen/arm: Introduce a virtual abort injection helper

2017-03-31 Thread Wei Chen
#if 0 to disable it in this patch temporarily to remove the warning message of unused function from compiler. Signed-off-by: Wei Chen <wei.c...@arm.com> Acked-by: Stefano Stabellini <sstabell...@kernel.org> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- v2->

[Xen-devel] [PATCH v3 12/19] xen/arm: Introduce new helpers to handle guest/hyp SErrors

2017-03-31 Thread Wei Chen
, that would be a bug. In the new helpers, we have used the function "inject_vabt_exception" which was disabled by "#if 0" before. Now, we can remove the "#if 0" to make this function to be available. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefan

[Xen-devel] [PATCH v3 08/19] xen/arm: Introduce a initcall to update cpu_hwcaps by serror_op

2017-03-31 Thread Wei Chen
, this may change in the future. So we introduce this initcall to guarantee the cpu_hwcaps can be updated no matter the serror parameter is placed in the command line or not. Signed-off-by: Wei Chen <wei.c...@arm.com> Acked-by: Julien Grall <julien.gr...@arm.com> Reviewed-by: Stefan

[Xen-devel] [PATCH v3 09/19] xen/arm64: Use alternative to skip the check of pending serrors

2017-03-31 Thread Wei Chen
. The ARM64 supports the alternative patching feature. We can use an ALTERNATIVE to avoid checking option at every trap. We added a new cpufeature named "SKIP_CHECK_PENDING_VSERROR". This feature will be enabled when the option is not diverse. Signed-off-by: Wei Chen <wei.c...@arm.com> Revi

[Xen-devel] [PATCH v3 13/19] xen/arm: Replace do_trap_guest_serror with new helpers

2017-03-31 Thread Wei Chen
We have introduced two helpers to handle the guest/hyp SErrors: do_trap_guest_serror and do_trap_guest_hyp_serror. These handlers can take the role of do_trap_guest_serror and reduce the assembly code in the same time. So we use these two helpers to replace it and drop it now. Signed-off-by: Wei

[Xen-devel] [PATCH v3 03/19] xen/arm: Set and restore HCR_EL2 register for each vCPU separately

2017-03-31 Thread Wei Chen
to restore the HCR_EL2 for each vCPU. Of course, the value of each vCPU's HCR_EL2 should be adjusted to have proper HCR_EL2.RW bit in this function. In the later patch of this series, we will set the HCR_EL2.RW for each vCPU while the domain is creating. Signed-off-by: wei chen <wei.c...@arm.com>

[Xen-devel] [PATCH v3 02/19] xen/arm: Introduce a helper to get default HCR_EL2 flags

2017-03-31 Thread Wei Chen
We want to add HCR_EL2 register to Xen context switch. And each copy of HCR_EL2 in vcpu structure will be initialized with the same set of trap flags as the HCR_EL2 register. We introduce a helper here to represent these flags to be reused easily. Signed-off-by: Wei Chen <wei.c...@arm.

[Xen-devel] [PATCH v3 01/19] xen/arm: Save ESR_EL2 to avoid using mismatched value in syndrome check

2017-03-31 Thread Wei Chen
to restore ELR and CPSR from stack at the same time. We have to use ldr to restore them separately. Signed-off-by: Wei Chen <wei.c...@arm.com> --- Note: This patch is a bug fix, this bug affects the 4.8 and 4.7 source trees too. v2->v3: 1. Add note to the commit message. 2. Read ESR_EL2 value

[Xen-devel] [PATCH v3 05/19] xen/arm: Save HCR_EL2 when a guest took the SError

2017-03-31 Thread Wei Chen
to restore it to HCR_EL2 when context switch to this guest. This is achieved by writing saved HCR_EL2 value in guest context back to HCR_EL2 register before return to guest. This had been done by the patch of "Restore HCR_EL2 register". Signed-off-by: Wei Chen <wei.c...@arm.com> Revi

[Xen-devel] [PATCH v3 04/19] xen/arm: Avoid setting/clearing HCR_RW at every context switch

2017-03-31 Thread Wei Chen
. Signed-off-by: Wei Chen <wei.c...@arm.com> Acked-by: Julien Grall <julien.gr...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/arm64/domctl.c | 6 ++ xen/arch/arm/domain.c| 5 + xen/arch/arm/domain_build.c | 7 +++

[Xen-devel] [PATCH v3 00/19] Provide a command line option to choose how to handle SErrors

2017-03-31 Thread Wei Chen
in separated patchs. Wei Chen (19): xen/arm: Save ESR_EL2 to avoid using mismatched value in syndrome check xen/arm: Introduce a helper to get default HCR_EL2 flags xen/arm: Set and restore HCR_EL2 register for each vCPU separately xen/arm: Avoid setting/clearing HCR_RW at every context

Re: [Xen-devel] [PATCH v2 16/19] xen/arm: Introduce a helper to synchronize SError

2017-03-31 Thread Wei Chen
On 2017/3/31 19:06, Julien Grall wrote: > > > On 31/03/17 11:55, Wei Chen wrote: >> Hi Julien, > > Hi Wei, > >> On 2017/3/31 2:38, Julien Grall wrote: >>> >>> >>> On 30/03/17 19:32, Julien Grall wrote: >>>> On 30/03/17 19:28,

Re: [Xen-devel] [PATCH v2 16/19] xen/arm: Introduce a helper to synchronize SError

2017-03-31 Thread Wei Chen
Hi Julien, On 2017/3/31 2:38, Julien Grall wrote: > > > On 30/03/17 19:32, Julien Grall wrote: >> On 30/03/17 19:28, Julien Grall wrote: >>> Hi Wei, >>> >>> On 30/03/17 10:13, Wei Chen wrote: >>>> +void synchronize_serror(void) >>> &

Re: [Xen-devel] [PATCH v2 04/19] xen/arm: Restore HCR_EL2 register

2017-03-31 Thread Wei Chen
On 2017/3/31 16:39, Julien Grall wrote: > Hi Wei, > > On 03/31/2017 03:10 AM, Wei Chen wrote: >> Hi Julien and Stefano, >> >> On 2017/3/31 6:03, Stefano Stabellini wrote: >>> On Thu, 30 Mar 2017, Julien Grall wrote: >>>> Hi Wei, >>>> &g

[Xen-devel] [PATCH v4] xen/arm32: Introduce alternative runtime patching

2017-03-31 Thread Wei Chen
he page.h of ARM32 doesn't include alternative.h, and we don't have the reason to include it to ARM32 page.h now. So we have to include the alternative.h directly in livepatch.c. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> --- v3-

Re: [Xen-devel] [PATCH v2 02/19] xen/arm: Remove vwfi while setting HCR_EL2 in init_traps

2017-03-31 Thread Wei Chen
On 2017/3/31 6:29, Stefano Stabellini wrote: > On Thu, 30 Mar 2017, Julien Grall wrote: >> Hi Wei, >> >> On 30/03/17 10:13, Wei Chen wrote: >>> We will set HCR_EL2 for each domain individually at the place where each >>> domain is created. vwfi will aff

Re: [Xen-devel] [PATCH v2 17/19] xen/arm: Isolate the SError between the context switch of 2 vCPUs

2017-03-30 Thread Wei Chen
On 2017/3/31 6:00, Julien Grall wrote: > > > On 30/03/2017 22:49, Stefano Stabellini wrote: >> On Thu, 30 Mar 2017, Wei Chen wrote: >>> +/* >>> + * If the SErrors option is "FORWARD", we have to prevent forwarding >>> + * serror to

Re: [Xen-devel] [PATCH v2 16/19] xen/arm: Introduce a helper to synchronize SError

2017-03-30 Thread Wei Chen
On 2017/3/31 2:38, Julien Grall wrote: > > > On 30/03/17 19:32, Julien Grall wrote: >> On 30/03/17 19:28, Julien Grall wrote: >>> Hi Wei, >>> >>> On 30/03/17 10:13, Wei Chen wrote: >>>> +void synchronize_serror(void) >>> &

Re: [Xen-devel] [PATCH v2 12/19] xen/arm: Move macro VABORT_GEN_BY_GUEST to common header

2017-03-30 Thread Wei Chen
On 2017/3/31 5:36, Stefano Stabellini wrote: > On Thu, 30 Mar 2017, Wei Chen wrote: >> We want to move part of SErrors checking code from hyp_error assembly code >> to a function. This new function will use this macro to distinguish the >> guest SErrors from hypervisor SError

Re: [Xen-devel] [PATCH v2 11/19] xen/arm32: Use alternative to skip the check of pending serrors

2017-03-30 Thread Wei Chen
On 2017/3/31 5:29, Stefano Stabellini wrote: > On Thu, 30 Mar 2017, Julien Grall wrote: >> Hi Wei, >> >> On 30/03/17 10:13, Wei Chen wrote: >>> We have provided an option to administrator to determine how to >>> handle the SErrors. In order to skip the check

Re: [Xen-devel] [PATCH v2 08/19] xen/arm: Introduce a command line parameter for SErrors/Aborts

2017-03-30 Thread Wei Chen
Hi Julien, On 2017/3/31 1:39, Julien Grall wrote: > Hi Wei, > > On 30/03/17 10:13, Wei Chen wrote: >> In order to distinguish guest-generated SErrors from hypervisor-generated >> SErrors we have to place SError checking code in every EL1 -> EL2 paths. >> That will

Re: [Xen-devel] [PATCH v2 07/19] xen/arm: Introduce a virtual abort injection helper

2017-03-30 Thread Wei Chen
On 2017/3/31 1:20, Julien Grall wrote: > Hi Wei, > > On 30/03/17 10:13, Wei Chen wrote: >> When guest triggers async aborts, in most platform, such aborts >> will be routed to hypervisor. But we don't want the hypervisor >> to handle such aborts, so we hav

Re: [Xen-devel] [PATCH v2 01/19] xen/arm: Save ESR_EL2 to avoid using mismatched value in syndrome check

2017-03-30 Thread Wei Chen
Hi Julien On 2017/3/30 21:31, Julien Grall wrote: > Hi Wei, > > On 30/03/17 10:13, Wei Chen wrote: >> Xen will do exception syndrome check while some types of exception >> take place in EL2. The syndrome check code read the ESR_EL2 register >> directly, but in some si

Re: [Xen-devel] [PATCH v3] xen/arm32: Introduce alternative runtime patching

2017-03-30 Thread Wei Chen
Hi Julien, On 2017/3/30 20:55, Julien Grall wrote: > Hi Wei, > > On 30/03/17 10:02, Wei Chen wrote: >> +/* Unconditional branch instructions */ >> +/* >> + * From ARM DDI 0406C.c Section A8.8.25. We can see blx has a H bit. >> + * In an ARM/Thumb instructions mi

Re: [Xen-devel] [PATCH v2 04/19] xen/arm: Restore HCR_EL2 register

2017-03-30 Thread Wei Chen
Hi Julien and Stefano, On 2017/3/31 6:03, Stefano Stabellini wrote: > On Thu, 30 Mar 2017, Julien Grall wrote: >> Hi Wei, >> >> On 30/03/17 10:13, Wei Chen wrote: >>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c >>> index de59e5f

[Xen-devel] [PATCH v2 14/19] xen/arm: Replace do_trap_guest_serror with new helpers

2017-03-30 Thread Wei Chen
We have introduced two helpers to handle the guest/hyp SErrors: do_trap_guest_serror and do_trap_guest_hyp_serror. These handlers can take the role of do_trap_guest_serror and reduce the assembly code in the same time. So we use these two helpers to replace it and drop it now. Signed-off-by: Wei

[Xen-devel] [PATCH v2 06/19] xen/arm: Save HCR_EL2 when a guest took the SError

2017-03-30 Thread Wei Chen
to restore it to HCR_EL2 when context switch to this guest. This is achieved by writing saved HCR_EL2 value in guest context back to HCR_EL2 register before return to guest. This had been done by the patch of "Restore HCR_EL2 register". Signed-off-by: Wei Chen <wei.c...@arm.com> Revi

[Xen-devel] [PATCH v2 10/19] xen/arm64: Use alternative to skip the check of pending serrors

2017-03-30 Thread Wei Chen
. The ARM64 supports the alternative patching feature. We can use an ALTERNATIVE to avoid checking option at every trap. We added a new cpufeature named "SKIP_CHECK_PENDING_VSERROR". This feature will be enabled when the option is not diverse. Signed-off-by: Wei Chen <wei.c...@arm.com> Revi

[Xen-devel] [PATCH v2 18/19] xen/arm: Prevent slipping hypervisor SError to guest

2017-03-30 Thread Wei Chen
n to guest. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/traps.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 9b4546e..f3d794e 100644 --- a/xen/arch

[Xen-devel] [PATCH v2 11/19] xen/arm32: Use alternative to skip the check of pending serrors

2017-03-30 Thread Wei Chen
. The ARM32 supports the alternative patching feature. We can use an ALTERNATIVE to avoid checking option at every trap. We added a new cpufeature named "SKIP_CHECK_PENDING_VSERROR". This feature will be enabled when the option is not diverse. Signed-off-by: Wei Chen <wei.c...@arm.com> -

[Xen-devel] [PATCH v2 12/19] xen/arm: Move macro VABORT_GEN_BY_GUEST to common header

2017-03-30 Thread Wei Chen
abort_guest_exit_start and abort_guest_exit_end. After we moved this macro to common header, we should export these two symbols to other source files that will use VABORT_GEN_BY_GUEST macro. So we change these two symbols to global. Signed-off-by: Wei Chen <wei.c...@arm.com> --- v1->v2: 1. Explain

[Xen-devel] [PATCH v2 07/19] xen/arm: Introduce a virtual abort injection helper

2017-03-30 Thread Wei Chen
. This would be useful when VM introspection will gain support of SVC32/64 trapping. This helper will be used by the later patches in this series, we use #if 0 to disable it in this patch temporarily to remove the warning message of unused function from compiler. Signed-off-by: Wei Chen <wei.c...@arm.

[Xen-devel] [PATCH v2 15/19] xen/arm: Unmask the Abort/SError bit in the exception entries

2017-03-30 Thread Wei Chen
to avoid receiving nested asynchronous abort, we don't unmask Abort/SError bit in hyp_error and trap_data_abort. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> --- xen/arch/arm/arm32/entry.S | 15 ++- xen/arch/arm/arm64/

[Xen-devel] [PATCH v2 16/19] xen/arm: Introduce a helper to synchronize SError

2017-03-30 Thread Wei Chen
ntroduce this helper to synchronize SErrors while returning to guest and doing context switch. This function should be used out of trap.c in later patch of this series. We have to export this helper in header file. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell

[Xen-devel] [PATCH v2 17/19] xen/arm: Isolate the SError between the context switch of 2 vCPUs

2017-03-30 Thread Wei Chen
e files. Signed-off-by: Wei Chen <wei.c...@arm.com> --- v1->v2: 1. Added a new flag in cpu_hwcaps to avoid using serror_op to skip synchronizing SError in context switch. 2. Update commit message to explain why we added this cpu_hwcaps. --- xen/arch/arm/domain.c| 14 +++

[Xen-devel] [PATCH v2 19/19] xen/arm: Handle guest external abort as guest SError

2017-03-30 Thread Wei Chen
The guest generated external data/instruction aborts can be treated as guest SErrors. We already have a handler to handle the SErrors, so we can reuse this handler to handle guest external aborts. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefano Stabellini <sstabell...@k

[Xen-devel] [PATCH v2 13/19] xen/arm: Introduce new helpers to handle guest/hyp SErrors

2017-03-30 Thread Wei Chen
, that would be a bug. In the new helpers, we have used the function "inject_vabt_exception" which was disabled by "#if 0" before. Now, we can remove the "#if 0" to make this function to be available. Signed-off-by: Wei Chen <wei.c...@arm.com> Reviewed-by: Stefan

[Xen-devel] [PATCH v2 00/19] Provide a command line option to choose how to handle SErrors

2017-03-30 Thread Wei Chen
in separated patchs. Wei Chen (19): xen/arm: Save ESR_EL2 to avoid using mismatched value in syndrome check xen/arm: Remove vwfi while setting HCR_EL2 in init_traps xen/arm: Move parse_vwfi from trap.c to domain.c xen/arm: Restore HCR_EL2 register xen/arm: Avoid setting/clearing HCR

  1   2   3   >