Re: [Xen-devel] [PATCH v5 1/4] VT-d PI: track the number of vcpus on pi blocking list

2017-08-31 Thread Chao Gao
On Thu, Aug 31, 2017 at 02:33:57AM -0600, Jan Beulich wrote: On 31.08.17 at 09:15, wrote: >> On Thu, Aug 31, 2017 at 01:42:53AM -0600, Jan Beulich wrote: >> On 31.08.17 at 00:57, wrote: On Wed, Aug 30, 2017 at 10:00:49AM -0600, Jan Beulich wrote: On 16.08.17 at 07:14, wrot

Re: [Xen-devel] [PATCH v2 1/4] x86/dom0: prevent access to MMCFG areas for PVH Dom0

2017-08-31 Thread Chao Gao
On Thu, Aug 31, 2017 at 10:03:19AM +0100, Roger Pau Monne wrote: >On Thu, Aug 31, 2017 at 03:32:42PM +0800, Chao Gao wrote: >> On Tue, Aug 29, 2017 at 08:33:25AM +0100, Roger Pau Monne wrote: >> >On Mon, Aug 28, 2017 at 06:18:13AM +, Tian, Kevin wrote: >> &g

Re: [Xen-devel] [PATCH v5 1/4] VT-d PI: track the number of vcpus on pi blocking list

2017-08-31 Thread Chao Gao
On Thu, Aug 31, 2017 at 02:33:57AM -0600, Jan Beulich wrote: On 31.08.17 at 09:15, wrote: >> On Thu, Aug 31, 2017 at 01:42:53AM -0600, Jan Beulich wrote: >> On 31.08.17 at 00:57, wrote: On Wed, Aug 30, 2017 at 10:00:49AM -0600, Jan Beulich wrote: On 16.08.17 at 07:14, wrot

Re: [Xen-devel] [PATCH v5 1/4] VT-d PI: track the number of vcpus on pi blocking list

2017-09-01 Thread Chao Gao
On Fri, Sep 01, 2017 at 02:24:08AM -0600, Jan Beulich wrote: On 01.09.17 at 03:39, wrote: >> After thinking it again, I want to define the counter as >> a unsigned int variable for the following reasion: >> 1. It is definite that the counter is closely related with >> list_add() and list_del(

Re: [Xen-devel] [PATCH v5 1/4] VT-d PI: track the number of vcpus on pi blocking list

2017-09-01 Thread Chao Gao
On Fri, Sep 01, 2017 at 03:13:17AM -0600, Jan Beulich wrote: On 01.09.17 at 09:55, wrote: >> On Fri, Sep 01, 2017 at 02:24:08AM -0600, Jan Beulich wrote: >> On 01.09.17 at 03:39, wrote: After thinking it again, I want to define the counter as a unsigned int variable for the fol

Re: [Xen-devel] [PATCH v2 1/4] x86/dom0: prevent access to MMCFG areas for PVH Dom0

2017-09-04 Thread Chao Gao
On Thu, Aug 31, 2017 at 11:09:48AM +0100, Roger Pau Monne wrote: >On Thu, Aug 31, 2017 at 04:45:23PM +0800, Chao Gao wrote: >> On Thu, Aug 31, 2017 at 10:03:19AM +0100, Roger Pau Monne wrote: >> >On Thu, Aug 31, 2017 at 03:32:42PM +0800, Chao Gao wrote: >> >> On T

Re: [Xen-devel] [PATCH v2 1/4] x86/dom0: prevent access to MMCFG areas for PVH Dom0

2017-09-04 Thread Chao Gao
On Mon, Sep 04, 2017 at 10:26:04AM +0100, Roger Pau Monné wrote: >(Adding Chao again because my MUA seems to drop him each time) > >On Mon, Sep 04, 2017 at 10:00:00AM +0100, Roger Pau Monné wrote: >> On Mon, Sep 04, 2017 at 02:25:10PM +0800, Chao Gao wrote: >> > On Thu, Au

[Xen-devel] How to create a PVHv2 guest

2017-09-10 Thread Chao Gao
Hi, Roger. I meet an error when creating a pvh guest. I am using commit 6e2a4c73564a. From the error log, I found bootlate_pv()->pin_table always failed. And the failure was caused by is_pv_domain(pg_owner) in do_mmuext_op(). Do you have any idea on this? The guest config file is: builder = "hvm

Re: [Xen-devel] [xen-unstable test] 113959: regressions - FAIL

2017-10-09 Thread Chao Gao
On Tue, Oct 03, 2017 at 11:08:01AM +0100, Roger Pau Monné wrote: >On Tue, Oct 03, 2017 at 09:55:44AM +, osstest service owner wrote: >> flight 113959 xen-unstable real [real] >> http://logs.test-lab.xenproject.org/osstest/logs/113959/ >> >> Regressions :-( >> >> Tests which did not succeed an

Re: [Xen-devel] [xen-unstable test] 113959: regressions - FAIL

2017-10-09 Thread Chao Gao
On Mon, Oct 09, 2017 at 02:13:22PM +0800, Chao Gao wrote: >On Tue, Oct 03, 2017 at 11:08:01AM +0100, Roger Pau Monné wrote: >>On Tue, Oct 03, 2017 at 09:55:44AM +, osstest service owner wrote: >>> flight 113959 xen-unstable real [real] >>> http://logs.test-lab.

Re: [Xen-devel] [xen-unstable test] 113959: regressions - FAIL

2017-10-09 Thread Chao Gao
On Mon, Oct 09, 2017 at 12:03:53PM +0100, Andrew Cooper wrote: >On 09/10/17 08:58, Chao Gao wrote: >> On Mon, Oct 09, 2017 at 02:13:22PM +0800, Chao Gao wrote: >>> On Tue, Oct 03, 2017 at 11:08:01AM +0100, Roger Pau Monné wrote: >>>> On Tue, Oct 03, 2017 at 09:55:44A

[Xen-devel] [PATCH] x86/vpt: fix a bug in pt_update_irq()

2017-10-09 Thread Chao Gao
patch holds the irq_lock when doing the two operations to prevent the case. Signed-off-by: Chao Gao --- xen/arch/x86/hvm/irq.c | 11 ++ xen/arch/x86/hvm/vlapic.c| 11 ++ xen/arch/x86/hvm/vpt.c | 43 xen/include/as

Re: [Xen-devel] [PATCH] x86/vpt: fix a bug in pt_update_irq()

2017-10-13 Thread Chao Gao
someone changes the vector field of IOAPIC RTE between asserting >> the irq and getting the vector of the irq, leading to setting the >> old vector number but returning a different vector number. This patch >> holds the irq_lock when doing the two operations to prevent the case. &

[Xen-devel] [PATCH v2] x86/vpt: guarantee the return value of pt_update_irq() set in vIRR or PIR

2017-10-13 Thread Chao Gao
or number. This patch allows hvm_isa_irq_assert() to accept a callback which can get the interrupt vector with irq_lock held. Thus, no one can change the vector between the two operations. Signed-off-by: Chao Gao --- passed the two simple xtf tests in https://lists.xenproject.org/archives/html/xe

Re: [Xen-devel] [PATCH v2] x86/vpt: guarantee the return value of pt_update_irq() set in vIRR or PIR

2017-10-16 Thread Chao Gao
On Mon, Oct 16, 2017 at 07:15:16AM -0600, Jan Beulich wrote: On 13.10.17 at 07:10, wrote: >> --- a/xen/arch/x86/hvm/irq.c >> +++ b/xen/arch/x86/hvm/irq.c >> @@ -168,11 +168,13 @@ void hvm_gsi_deassert(struct domain *d, unsigned int >> gsi) >> spin_unlock(&d->arch.hvm_domain.irq_lock); >

Re: [Xen-devel] [PATCH v2] x86/vpt: guarantee the return value of pt_update_irq() set in vIRR or PIR

2017-10-16 Thread Chao Gao
On Mon, Oct 16, 2017 at 08:26:09AM -0600, Jan Beulich wrote: On 16.10.17 at 15:13, wrote: >> On Mon, Oct 16, 2017 at 07:15:16AM -0600, Jan Beulich wrote: >> On 13.10.17 at 07:10, wrote: --- a/xen/arch/x86/hvm/irq.c +++ b/xen/arch/x86/hvm/irq.c @@ -168,11 +168,13 @@ void hv

Re: [Xen-devel] [PATCH V3 22/29] x86/vioapic: extend vioapic_get_vector() to support remapping format RTE

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 09:56:34AM -0600, Jan Beulich wrote: On 19.10.17 at 17:49, wrote: >> On Thu, Sep 21, 2017 at 11:02:03PM -0400, Lan Tianyu wrote: >>> --- a/xen/arch/x86/hvm/vioapic.c >>> +++ b/xen/arch/x86/hvm/vioapic.c >>> @@ -561,11 +561,25 @@ int vioapic_get_vector(const struct doma

Re: [Xen-devel] [PATCH V3 6/29] tools/libxl: Add a user configurable parameter to control vIOMMU attributes

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 10:49:22AM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:47PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> A field, viommu_info, is added to struct libxl_domain_build_info. Several >> attributes can be specified by guest co

Re: [Xen-devel] [PATCH V3 7/29] tools/libxl: build DMAR table for a guest with one virtual VTD

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 11:00:27AM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:48PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> A new logic is added to build ACPI DMAR table in tool stack for a guest >> with one virtual VTD and pass throu

Re: [Xen-devel] [PATCH V3 10/29] vtd: add and align register definitions

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 11:21:35AM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:51PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> No functional changes. >> >> Signed-off-by: Chao Gao >> Signed-off-by: Lan Tianyu > >Reviewed-by:

Re: [Xen-devel] [PATCH V3 11/29] x86/hvm: Introduce a emulated VTD for HVM

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 12:20:35PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:52PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> This patch adds create/destroy function for the emulated VTD >> and adapts it to the common VIOMMU abstraction. >

Re: [Xen-devel] [PATCH V3 12/29] x86/vvtd: Add MMIO handler for VVTD

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 12:34:54PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:53PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> This patch adds VVTD MMIO handler to deal with MMIO access. >> >> Signed-off-by: Chao Gao >> Signed-off

Re: [Xen-devel] [PATCH V3 13/29] x86/vvtd: Set Interrupt Remapping Table Pointer through GCMD

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 12:56:45PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:54PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Software sets this field to set/update the interrupt remapping table pointer >> used by hardware. The interrupt

Re: [Xen-devel] [PATCH V3 15/29] x86/vvtd: Process interrupt remapping request

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 03:26:30PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:56PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> When a remapping interrupt request arrives, remapping hardware computes the >> interrupt_index per the algo

Re: [Xen-devel] [PATCH V3 16/29] x86/vvtd: decode interrupt attribute from IRTE

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 03:39:44PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:01:57PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Without interrupt remapping, interrupt attributes can be extracted from >> msi message or IOAPIC RTE. However, with

Re: [Xen-devel] [PATCH V3 24/29] tools/libxc: Add a new interface to bind remapping format msi with pirq

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 05:03:26PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:02:05PM -0400, Lan Tianyu wrote: >> From: Chao Gao > >The title for this patch it's wrong, it modifies both the hypervisor >and libxc. Please fix it. > >> When exposing v

Re: [Xen-devel] [PATCH V3 26/29] x86/vvtd: Handle interrupt translation faults

2017-10-19 Thread Chao Gao
On Thu, Oct 19, 2017 at 05:31:37PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:02:07PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Interrupt translation faults are non-recoverable fault. When faults >> are triggered, it needs to populate fa

Re: [Xen-devel] [PATCH V3 11/29] x86/hvm: Introduce a emulated VTD for HVM

2017-10-20 Thread Chao Gao
On Fri, Oct 20, 2017 at 12:56:03AM -0600, Jan Beulich wrote: >>>> On 20.10.17 at 04:46, wrote: >> On Thu, Oct 19, 2017 at 12:20:35PM +0100, Roger Pau Monné wrote: >>>On Thu, Sep 21, 2017 at 11:01:52PM -0400, Lan Tianyu wrote: >>>> From: Chao Gao >>>

[Xen-devel] [PATCH v3 for 4.10] x86/vpt: guarantee the return value of pt_update_irq() set in vIRR or PIR

2017-10-20 Thread Chao Gao
or number. This patch allows hvm_isa_irq_assert() to accept a callback which can get the interrupt vector with irq_lock held. Thus, no one can change the vector between the two operations. BTW, the first argument of pi_test_and_set_pir() should be uint8_t and I take this chance to fix it. Signed-o

Re: [Xen-devel] [PATCH V3 15/29] x86/vvtd: Process interrupt remapping request

2017-10-23 Thread Chao Gao
On Fri, Oct 20, 2017 at 11:01:03AM +0100, Roger Pau Monné wrote: >On Fri, Oct 20, 2017 at 01:16:37PM +0800, Chao Gao wrote: >> On Thu, Oct 19, 2017 at 03:26:30PM +0100, Roger Pau Monné wrote: >> >On Thu, Sep 21, 2017 at 11:01:56PM -0400, Lan Tianyu wrote: >> >> +sta

Re: [Xen-devel] [PATCH V3 28/29] x86/vvtd: Add queued invalidation (QI) support

2017-10-23 Thread Chao Gao
On Fri, Oct 20, 2017 at 12:20:06PM +0100, Roger Pau Monné wrote: >On Thu, Sep 21, 2017 at 11:02:09PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Queued Invalidation Interface is an expanded invalidation interface with >> extended capabilities. Hardware impleme

Re: [Xen-devel] [PATCH V3 28/29] x86/vvtd: Add queued invalidation (QI) support

2017-10-23 Thread Chao Gao
On Mon, Oct 23, 2017 at 09:57:16AM +0100, Roger Pau Monné wrote: >On Mon, Oct 23, 2017 at 03:50:24PM +0800, Chao Gao wrote: >> On Fri, Oct 20, 2017 at 12:20:06PM +0100, Roger Pau Monné wrote: >> >On Thu, Sep 21, 2017 at 11:02:09PM -0400, Lan Tianyu wrote: &g

[Xen-devel] [PATCH v4 02/28] VIOMMU: Add vIOMMU framework and vIOMMU domctl

2017-11-16 Thread Chao Gao
destroying domain. Signed-off-by: Lan Tianyu Signed-off-by: Chao Gao --- v4: - introduce REGISTER_VIOMMU() to register viommu types and ops. - remove unneeded domctl interface to destroy viommu. --- docs/misc/xen-command-line.markdown | 7 ++ xen/arch/x86/Kconfig| 1 + xen/arch

[Xen-devel] [PATCH v4 01/28] Xen/doc: Add Xen virtual IOMMU doc

2017-11-16 Thread Chao Gao
From: Lan Tianyu This patch is to add Xen virtual IOMMU doc to introduce motivation, framework, vIOMMU hypercall and xl configuration. Signed-off-by: Lan Tianyu Signed-off-by: Chao Gao --- docs/misc/viommu.txt | 120 +++ 1 file changed, 120

[Xen-devel] [PATCH v4 05/28] VIOMMU: Introduce callback of checking irq remapping mode

2017-11-16 Thread Chao Gao
From: Lan Tianyu This patch is to add callback for vIOAPIC and vMSI to check whether interrupt remapping is enabled. Signed-off-by: Lan Tianyu Signed-off-by: Chao Gao --- xen/common/viommu.c | 15 +++ xen/include/xen/viommu.h | 4 2 files changed, 19 insertions

[Xen-devel] [PATCH v4 04/28] VIOMMU: Add get irq info callback to convert irq remapping request

2017-11-16 Thread Chao Gao
From: Lan Tianyu This patch is to add get_irq_info callback for platform implementation to convert irq remapping request to irq info (E,G vector, dest, dest_mode and so on). Signed-off-by: Lan Tianyu Signed-off-by: Chao Gao --- xen/common/viommu.c | 16 xen/include

[Xen-devel] [PATCH v4 00/28] add vIOMMU support with irq remapping function of virtual VT-d

2017-11-16 Thread Chao Gao
Intel VTD). 5) Add save and restore support for vvtd Chao Gao (23): vtd: clean-up and preparation for vvtd x86/hvm: Introduce a emulated VTD for HVM x86/vvtd: Add MMIO handler for VVTD x86/vvtd: Set Interrupt Remapping Table Pointer through GCMD x86/vvtd: Enable Interrupt Remappi

[Xen-devel] [PATCH v4 03/28] VIOMMU: Add irq request callback to deal with irq remapping

2017-11-16 Thread Chao Gao
From: Lan Tianyu This patch is to add irq request callback for platform implementation to deal with irq remapping request. Signed-off-by: Lan Tianyu Signed-off-by: Chao Gao --- xen/common/viommu.c | 15 xen/include/asm-x86/viommu.h | 54

[Xen-devel] [PATCH v4 09/28] x86/vvtd: Set Interrupt Remapping Table Pointer through GCMD

2017-11-16 Thread Chao Gao
track info (e.g. the table's gfn and max supported entries) of interrupt remapping table. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - declare eim_enabled as bool and irt as gfn_t - rename vvtd_handle_gcmd_sirtp() to write_gcmd_sirtp() v3: - ignore unaligned r/w of vt-d har

[Xen-devel] [PATCH v4 07/28] x86/hvm: Introduce a emulated VTD for HVM

2017-11-16 Thread Chao Gao
This patch adds create/destroy function for the emulated VTD and adapts it to the common VIOMMU abstraction. As the Makefile is changed here, put all files in alphabetic order by this chance. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - use REGISTER_VIOMMU - shrink the size of

[Xen-devel] [PATCH v4 11/28] x86/vvtd: Process interrupt remapping request

2017-11-16 Thread Chao Gao
g flags to show that some operations are completed. These operations include enabling interrupt remapping and performing a kind of invalidation requests. In vvtd, we also try to drain in-flight interrupts by waiting the inflight_intr is decreased to 0. Signed-off-by: Chao Gao Signed-off-by: Lan Tiany

[Xen-devel] [PATCH v4 06/28] vtd: clean-up and preparation for vvtd

2017-11-16 Thread Chao Gao
. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - Only fix the alignment and defer introducing new definition to when they are needed (Suggested-by Roger Pau Monné) - remove parts of open-coded masks v3: - new --- xen/drivers/passthrough/vtd/iommu.h | 86

[Xen-devel] [PATCH v4 10/28] x86/vvtd: Enable Interrupt Remapping through GCMD

2017-11-16 Thread Chao Gao
ff-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - map guest's interrupt reampping table to Xen permanently rather than mapping one specific page on demand. --- xen/drivers/passthrough/vtd/iommu.h | 3 +- xen/drivers/passthrough/vtd/vvtd.c | 98 + 2 fil

[Xen-devel] [PATCH v4 19/28] x86/vioapic: extend vioapic_get_vector() to support remapping format RTE

2017-11-16 Thread Chao Gao
When IOAPIC RTE is in remapping format, it doesn't contain the vector of interrupt. For this case, the RTE contains an index of interrupt remapping table where the vector of interrupt is stored. This patchs gets the vector through a vIOMMU interface. Signed-off-by: Chao Gao Signed-off-by

[Xen-devel] [PATCH v4 16/28] x86/vvtd: Add queued invalidation (QI) support

2017-11-16 Thread Chao Gao
buffer in system memory. Software submits commands by writing Invalidation Descriptors to the IQ. In this patch, a new function viommu_process_iq() is used for emulating how hardware handles invalidation requests through QI. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4

[Xen-devel] [PATCH v4 17/28] x86/vvtd: save and restore emulated VT-d

2017-11-16 Thread Chao Gao
Provide a save-restore pair to save/restore registers and non-register status. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v3: - use one entry to save both vvtd registers and other intermediate state --- xen/drivers/passthrough/vtd/vvtd.c | 57

[Xen-devel] [PATCH v4 12/28] x86/vvtd: decode interrupt attribute from IRTE

2017-11-16 Thread Chao Gao
. vioapic_get_vector(). With vIOMMU, the RTE may don't contain vector. 2. perform EOI which is always based on the interrupt vector. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v3: - add example cases in which we will use this function. --- xen/drivers/passthrough/vtd/vvtd.c

[Xen-devel] [PATCH v4 25/28] tools/libxl: Add an user configurable parameter to control vIOMMU attributes

2017-11-16 Thread Chao Gao
A field, viommu_info, is added to struct libxl_domain_build_info. Several attributes can be specified by guest config file for virtual IOMMU. These attributes are used for DMAR construction and vIOMMU creation. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - Move

[Xen-devel] [PATCH v4 21/28] vvtd: update hvm_gmsi_info when binding guest msi with pirq or

2017-11-16 Thread Chao Gao
process_iq() in vvtd_read() rather than in vvtd_handle_irq_request() is to avoid ABBA deadlock of d->event_lock and vvtd->ie_lock. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - new --- xen/arch/x86/hvm/hvm.c | 2 +- xen/drivers/passth

[Xen-devel] [PATCH v4 22/28] x86/vmsi: Hook delivering remapping format msi to guest and handling eoi

2017-11-16 Thread Chao Gao
re used to search the physical irq. It is clear that for remapping format msi, the interrupt attributs should be decodes from IRTE. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- xen/arch/x86/hvm/irq.c | 6 ++ xen/arch/x86/hvm/vmsi.c | 33 +---

[Xen-devel] [PATCH v4 23/28] tools/libacpi: Add DMA remapping reporting (DMAR) ACPI table structures

2017-11-16 Thread Chao Gao
Add dmar table structure according Chapter 8 "BIOS Considerations" of VTd spec Rev. 2.4. VTd spec:http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/vt-directed-io-spec.pdf Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- tools/libacpi/acpi

[Xen-devel] [PATCH v4 15/28] x86/vvtd: Enable Queued Invalidation through GCMD

2017-11-16 Thread Chao Gao
Software writes to QIE field of GCMD to enable or disable queued invalidations. This patch emulates QIE field of GCMD. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- xen/drivers/passthrough/vtd/iommu.h | 3 ++- xen/drivers/passthrough/vtd/vvtd.c | 18 ++ 2 files

[Xen-devel] [PATCH v4 26/28] tools/libxl: build DMAR table for a guest with one virtual VTD

2017-11-16 Thread Chao Gao
A new logic is added to init_acpi_config(). The logic initializes some fields introduced for DMAR table. For PVH guest, the DMAR table is built as other tables. But for HVM guest, only the DMAR table is built in toolstack and pass through it to guest via existing mechanism. Signed-off-by: Chao

[Xen-devel] [PATCH v4 18/28] x86/vioapic: Hook interrupt delivery of vIOAPIC

2017-11-16 Thread Chao Gao
When irq remapping is enabled, IOAPIC Redirection Entry may be in remapping format. If that, generate an irq_remapping_request and call the common VIOMMU abstraction's callback to handle this interrupt request. Device model is responsible for checking the request's validity. Signed-of

[Xen-devel] [PATCH v4 14/28] x86/vvtd: Handle interrupt translation faults

2017-11-16 Thread Chao Gao
_fault() reports faults to software. Currently, only Primary Fault Logging is supported and the Number of Fault-recording Registers is 1. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - introduce a lock to protect fault-event related regs --- xen/drivers/passthrough/vtd/iommu.h |

[Xen-devel] [PATCH v4 20/28] xen/pt: when binding guest msi, accept the whole msi message

2017-11-16 Thread Chao Gao
significantly reduce the efforts to support binding remappable format msi. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - new --- tools/libxc/include/xenctrl.h | 7 --- tools/libxc/xc_domain.c | 14 -- xen/arch/x86/hvm/vmsi.c | 12 ++-- xen/drivers

[Xen-devel] [PATCH v4 13/28] x86/vvtd: add a helper function to decide the interrupt format

2017-11-16 Thread Chao Gao
. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v3: - new --- xen/drivers/passthrough/vtd/vvtd.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/xen/drivers/passthrough/vtd/vvtd.c b/xen/drivers/passthrough/vtd/vvtd.c index 9890cc2..d3dec01 100644 --- a/xen/drivers

[Xen-devel] [PATCH v4 08/28] x86/vvtd: Add MMIO handler for VVTD

2017-11-16 Thread Chao Gao
This patch adds VVTD MMIO handler to deal with MMIO access. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - only trap the register emulated in vvtd_in_range(). i.e. replace PAGE_SIZE with the VVTD_MAX_OFFSET --- xen/drivers/passthrough/vtd/vvtd.c | 55

[Xen-devel] [PATCH v3 3/3] msi: Handle remappable format interrupt request

2017-11-16 Thread Chao Gao
a pirq. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v3: - clarify the interrupt format bit is Intel-specific, then it is improper to define MSI_ADDR_IF_MASK in a common header. --- hw/i386/xen/xen-hvm.c | 10 +- hw/pci/msi.c | 5 +++-- hw/pci/msix.c | 4 +++-

[Xen-devel] [PATCH v4 27/28] tools/libxl: create vIOMMU during domain construction

2017-11-16 Thread Chao Gao
If guest is configured to have a vIOMMU, create it during domain construction. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - s/LOGED/LOGD v3: - Remove the process of querying capabilities. --- tools/libxl/libxl_x86.c | 17 + 1 file changed, 17 insertions

[Xen-devel] [PATCH v3 0/3] Qemu: add Xen vIOMMU interrupt remapping function support

2017-11-16 Thread Chao Gao
exist interface is modified to support msi of both format. - In patch 3, define MSI_ADDR_IF_MASK inside a function because it is intel-specific. It is improper to define it in a common header. Chao Gao (3): i386/msi: Correct mask of destination ID in MSI address xen/pt: Pass the whole msi addr/data

[Xen-devel] [PATCH v4 28/28] tools/libxc: Add viommu operations in libxc

2017-11-16 Thread Chao Gao
Add libxc helpers for XEN_DOMCTL_viommu_op. Now, it has one sub-command - create(): create a vIOMMU in Xen, given viommu type, register-set location and capabilities Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - remove destroy() sub-command v3: - Remove API for

[Xen-devel] [PATCH v4 24/28] tools/libacpi: Add new fields in acpi_config for DMAR table

2017-11-16 Thread Chao Gao
table according to the new fields. The header files in ovmf.c are re-ordered to avoid including in tools/libacpi/libacpi.h. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v4: - initialize variables during declaration if possible - reorder the sequence of header files to avoid including

[Xen-devel] [PATCH v3 2/3] xen/pt: Pass the whole msi addr/data to Xen

2017-11-16 Thread Chao Gao
filtering. The main reason why we want this is QEMU doesn't have the knowledge to decide the interrupt format after we introduce vIOMMU inside Xen. Passing the whole msi message down and let arch-specific vIOMMU to decide the interrupt format. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu -

[Xen-devel] [PATCH] Revert "VT-d: fix VF of RC integrated PF matched to wrong VT-d unit"

2017-07-25 Thread Chao Gao
0x1ef/0x42c (XEN)[] entry.o#test_all_events+0/0x30 (XEN) (XEN) (XEN) (XEN) Panic on CPU 2: (XEN) Xen BUG at spinlock.c:47 (XEN) (XEN) (XEN) Reboot in five seconds... Signed-off-by: Chao Gao --- xen/drivers/passth

Re: [Xen-devel] [PATCH v4 4/4] Xentrace: add support for HVM's PI blocking list operation

2017-07-28 Thread Chao Gao
On Fri, Jul 21, 2017 at 05:26:47PM +0100, George Dunlap wrote: >On Fri, Jul 7, 2017 at 7:49 AM, Chao Gao wrote: >> In order to analyze PI blocking list operation frequence and obtain >> the list length, add some relevant events to xentrace and some >> associated co

[Xen-devel] [Question] how to avoid Xen using a memory range?

2017-08-04 Thread Chao Gao
Hi, everyone. I have a machine which has two numa nodes. The NODE0 contains memory range from 0 to 0x18400MB and NODE1 contains memory range from 0x18400MB to 0x1c400MB. The resource available to dom0 is restricted through adding "dom0_mem=10G dom0_nodes=0 dom0_max_vcpus=48" to Xen Command Line. E

Re: [Xen-devel] [PATCH] VT-d: fix VF of RC integrated endpoint matched to wrong VT-d unit

2017-06-20 Thread Chao Gao
On Mon, Jun 19, 2017 at 01:43:25AM -0600, Jan Beulich wrote: On 19.06.17 at 08:33, wrote: >> On Fri, Jun 16, 2017 at 09:52:11AM -0600, Jan Beulich wrote: >> On 16.06.17 at 08:48, wrote: The problem is a VF of RC integrated PF (e.g. PF's BDF is 00:02.0), we would wrongly use 00:

[Xen-devel] [PATCH v2] VT-d: fix VF of RC integrated endpoint matched to wrong VT-d unit

2017-06-21 Thread Chao Gao
I-capable but may have devfn > 7. This patch directly looks up the 'is_extfn' field of PF's struct pci_dev to decide whether the PF is a extended function. Reported-by: Crawford Eric R Signed-off-by: Chao Gao --- xen/drivers/passthrough/vtd/dmar.c | 12 +++- 1 file chan

Re: [Xen-devel] [PATCH v3] VT-d PI: track the vcpu number in pi blocking list

2017-06-21 Thread Chao Gao
On Fri, Jun 16, 2017 at 08:34:20AM -0600, Jan Beulich wrote: On 24.05.17 at 08:56, wrote: >> --- a/xen/arch/x86/hvm/vmx/vmx.c >> +++ b/xen/arch/x86/hvm/vmx/vmx.c >> @@ -82,6 +82,7 @@ static int vmx_vmfunc_intercept(struct cpu_user_regs >> *regs); >> struct vmx_pi_blocking_vcpu { >> str

Re: [Xen-devel] [PATCH v2] VT-d: fix VF of RC integrated endpoint matched to wrong VT-d unit

2017-06-22 Thread Chao Gao
On Thu, Jun 22, 2017 at 03:26:04AM -0600, Jan Beulich wrote: On 21.06.17 at 12:47, wrote: >> The problem is a VF of RC integrated PF (e.g. PF's BDF is 00:02.0), >> we would wrongly use 00:00.0 to search VT-d unit. >> >> To search VT-d unit for a VF, the BDF of the PF is used. And If the >> P

Re: [Xen-devel] [PATCH v3 3/3] VT-d PI: restrict the vcpu number on a given pcpu

2017-06-22 Thread Chao Gao
On Fri, Jun 16, 2017 at 09:09:13AM -0600, Jan Beulich wrote: On 24.05.17 at 08:56, wrote: >> Currently, a blocked vCPU is put in its pCPU's pi blocking list. If >> too many vCPUs are blocked on a given pCPU, it will incur that the list >> grows too long. After a simple analysis, there are 32k

Re: [Xen-devel] [PATCH v3 3/3] VT-d PI: restrict the vcpu number on a given pcpu

2017-06-23 Thread Chao Gao
On Fri, Jun 23, 2017 at 01:58:52AM -0600, Jan Beulich wrote: On 23.06.17 at 06:22, wrote: >> On Fri, Jun 16, 2017 at 09:09:13AM -0600, Jan Beulich wrote: >> On 24.05.17 at 08:56, wrote: +{ +pi_cpu = cpumask_cycle(pi_cpu, &cpu_online_map); >>> >>>With this, how could

[Xen-devel] [PATCH v3] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-06-28 Thread Chao Gao
e original code did; The original code wasn't aware the former. This patch directly looks up the 'is_extfn' field of PF's struct pci_dev to decide whether the PF is a extended function. Reported-by: Crawford, Eric R Signed-off-by: Chao Gao --- xen/drivers/passthrough/vtd/d

Re: [Xen-devel] [PATCH v3] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-06-29 Thread Chao Gao
On Thu, Jun 29, 2017 at 04:42:33PM +0100, Roger Pau Monné wrote: >On Thu, Jun 29, 2017 at 11:21:53AM +0800, Chao Gao wrote: >> The problem is for a VF of RC integrated PF (e.g. PF's BDF is 00:02.0), >> we would wrongly use 00:00.0 to search VT-d unit. >> >> From

[Xen-devel] [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-06-29 Thread Chao Gao
e original code did; The original code wasn't aware the former. This patch directly looks up the 'is_extfn' field of PF's struct pci_dev to decide whether the PF is a extended function. Reported-by: Crawford, Eric R Signed-off-by: Chao Gao --- v3: - access pf's struct pci

Re: [Xen-devel] [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-07-02 Thread Chao Gao
On Fri, Jun 30, 2017 at 05:19:52PM +0800, Tian, Kevin wrote: >> From: Gao, Chao >> Sent: Friday, June 30, 2017 9:17 AM >> >> The problem is for a VF of RC integrated PF (e.g. PF's BDF is 00:02.0), >> we would wrongly use 00:00.0 to search VT-d unit. >> >> From SRIOV spec REV 1.0 section 3.7.3, it

Re: [Xen-devel] [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-07-04 Thread Chao Gao
On Wed, Jul 05, 2017 at 10:46:39AM +0800, Tian, Kevin wrote: >> From: Gao, Chao >> Sent: Monday, July 3, 2017 12:37 PM >> >> On Fri, Jun 30, 2017 at 05:19:52PM +0800, Tian, Kevin wrote: >> >> From: Gao, Chao >> >> Sent: Friday, June 30, 2017 9:17 AM >> >> >> >> The problem is for a VF of RC integr

Re: [Xen-devel] [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-07-05 Thread Chao Gao
On Wed, Jul 05, 2017 at 01:18:38PM +0800, Tian, Kevin wrote: >> From: Gao, Chao >> Sent: Wednesday, July 5, 2017 12:28 PM >> >> On Wed, Jul 05, 2017 at 10:46:39AM +0800, Tian, Kevin wrote: >> >> From: Gao, Chao >> >> Sent: Monday, July 3, 2017 12:37 PM >> >> >> >> On Fri, Jun 30, 2017 at 05:19:52P

Re: [Xen-devel] [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-07-05 Thread Chao Gao
On Wed, Jul 05, 2017 at 09:29:29AM +0100, Roger Pau Monné wrote: >On Wed, Jul 05, 2017 at 02:19:17AM -0600, Jan Beulich wrote: >> >>> On 05.07.17 at 09:56, wrote: >> > How about changing the second paragraph to: >> > >> > If a PF is an extended function, the BDF of a traditional function >> > wit

[Xen-devel] [PATCH v5] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit

2017-07-06 Thread Chao Gao
ing 'is_extfn' field of struct pci_dev has been passed down from Domain0 to indicate whether the function is an extended function, this patch just looks up the 'is_extfn' field of PF's struct pci_dev and set 'devfn' to 0 when 'is_extfn' is true. Repo

[Xen-devel] [PATCH v4 1/4] VT-d PI: track the vcpu number on pi blocking list

2017-07-06 Thread Chao Gao
This patch adds a field, counter, in struct vmx_pi_blocking_vcpu to track how many entries are on the pi blocking list. Signed-off-by: Chao Gao --- v4: - non-trace part of Patch 1 in v3 --- xen/arch/x86/hvm/vmx/vmx.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff

[Xen-devel] [PATCH v4 0/4] mitigate the per-pCPU blocking list may be too long

2017-07-06 Thread Chao Gao
20The%20length%20of%20the%20list%20depends;#422567 [3] https://lists.gt.net/xen/devel/472749?search_string=enable%20vt-d%20pi%20by%20default;#472749 Chao Gao (4): VT-d PI: track the vcpu number on pi blocking list x86/vcpu: track hvm vcpu number on the system VT-d PI: restrict the vcpu number o

[Xen-devel] [PATCH v4 2/4] x86/vcpu: track hvm vcpu number on the system

2017-07-06 Thread Chao Gao
This number is used to calculate the average vcpus per pcpu ratio. Signed-off-by: Chao Gao --- v4: - move the place we increase/decrease the hvm vcpu number to hvm_vcpu_{initialise, destory} --- xen/arch/x86/hvm/hvm.c| 6 ++ xen/include/asm-x86/hvm/hvm.h | 3 +++ 2 files changed

[Xen-devel] [PATCH v4 3/4] VT-d PI: restrict the vcpu number on a given pcpu

2017-07-06 Thread Chao Gao
th of the pcpu where the vcpu is running exceeds the limit which is the average vcpus per pcpu ratio plus a constant. If no, the vcpu is added to this pcpu's pi blocking list. Otherwise, another online pcpu is chosen to accept the vcpu. Signed-off-by: Chao Gao --- v4: - use a new lock to avoid

[Xen-devel] [PATCH v4 4/4] Xentrace: add support for HVM's PI blocking list operation

2017-07-06 Thread Chao Gao
suitable any more. Thus, this patch extends the toplevel_assert_check() to remove such assumptions for events of type ASYNC_PI_LIST_DEL. Signed-off-by: Chao Gao --- v4: - trace part of Patch 1 in v3 --- tools/xentrace/formats | 3 + tools/xentrace/xenalyze.c | 154

Re: [Xen-devel] [PATCH v4 4/4] Xentrace: add support for HVM's PI blocking list operation

2017-07-09 Thread Chao Gao
On Fri, Jul 07, 2017 at 09:37:04AM -0600, Jan Beulich wrote: On 07.07.17 at 08:49, wrote: >> --- a/xen/arch/x86/hvm/vmx/vmx.c >> +++ b/xen/arch/x86/hvm/vmx/vmx.c >> @@ -190,7 +190,9 @@ static void vmx_vcpu_block(struct vcpu *v) >> */ >> ASSERT(old_lock == NULL); >> >> -per_cp

Re: [Xen-devel] [PATCH v4 1/4] VT-d PI: track the vcpu number on pi blocking list

2017-07-09 Thread Chao Gao
On Fri, Jul 07, 2017 at 09:41:18AM -0600, Jan Beulich wrote: >>>> On 07.07.17 at 08:48, wrote: >> This patch adds a field, counter, in struct vmx_pi_blocking_vcpu to track >> how many entries are on the pi blocking list. >> >> Signed-off-by: Chao Gao &g

Re: [Xen-devel] [PATCH v4 3/4] VT-d PI: restrict the vcpu number on a given pcpu

2017-07-09 Thread Chao Gao
On Fri, Jul 07, 2017 at 09:57:47AM -0600, Jan Beulich wrote: On 07.07.17 at 08:48, wrote: >> --- a/xen/arch/x86/hvm/vmx/vmx.c >> +++ b/xen/arch/x86/hvm/vmx/vmx.c >> @@ -95,22 +95,91 @@ static DEFINE_PER_CPU(struct vmx_pi_blocking_vcpu, >> vmx_pi_blocking); >> uint8_t __read_mostly posted_in

Re: [Xen-devel] [PATCH v4 3/4] VT-d PI: restrict the vcpu number on a given pcpu

2017-07-10 Thread Chao Gao
On Mon, Jul 10, 2017 at 03:36:52AM -0600, Jan Beulich wrote: On 10.07.17 at 03:17, wrote: >> On Fri, Jul 07, 2017 at 09:57:47AM -0600, Jan Beulich wrote: >> On 07.07.17 at 08:48, wrote: +#define remote_pbl_operation_begin(flags) \ +({

Re: [Xen-devel] How to create a PVHv2 guest

2017-09-11 Thread Chao Gao
On Mon, Sep 11, 2017 at 10:14:15AM +0100, Roger Pau Monné wrote: >On Mon, Sep 11, 2017 at 09:58:01AM +0800, Chao Gao wrote: >> Hi, Roger. >> >> I meet an error when creating a pvh guest. I am using commit 6e2a4c73564a. >> From the error log, I found bootlate_pv()-&g

Re: [Xen-devel] [xen-unstable test] 106504: regressions - FAIL

2017-03-28 Thread Chao Gao
On Wed, Mar 29, 2017 at 03:28:43AM +, Xuquan (Quan Xu) wrote: >On March 22, 2017 2:14 PM, Chao Gao wrote: >>On Wed, Mar 22, 2017 at 06:47:33AM -0600, Jan Beulich wrote: >>>> 3. We read RTE 3 times. 1st happens when we set vIRR. 2nd happens >>>> when >>>

Re: [Xen-devel] [RFC PATCH 5/23] Tools/libxc: Add viommu operations in libxc

2017-03-29 Thread Chao Gao
Tianyu is on vacation this two weeks, so I will try to address some comments on this series. On Tue, Mar 28, 2017 at 05:24:03PM +0100, Wei Liu wrote: >On Fri, Mar 17, 2017 at 07:27:05PM +0800, Lan Tianyu wrote: >> From: Chao Gao >> >> In previous patch, we introduce a co

Re: [Xen-devel] [RFC PATCH 00/23] xen/vIOMMU: Add vIOMMU support with irq remapping fucntion on Intel platform

2017-03-29 Thread Chao Gao
On Wed, Mar 29, 2017 at 09:00:58AM +0100, Roger Pau Monné wrote: >On Tue, Mar 21, 2017 at 01:29:26PM +0800, Lan Tianyu wrote: >> On 2017年03月21日 10:28, Lan Tianyu wrote: >> > On 2017年03月20日 22:23, Roger Pau Monné wrote: >> >> Thanks! So you add all this vIOMMU code, but the maximum number of allowed

[Xen-devel] [PATCH v11 3/6] VT-d: Some cleanups

2017-03-29 Thread Chao Gao
From: Feng Wu Use type-safe structure assignment instead of memcpy() Use sizeof(*iremap_entry). Signed-off-by: Feng Wu Signed-off-by: Chao Gao Reviewed-by: Konrad Rzeszutek Wilk Acked-by: Kevin Tian --- v10: - Added several lines for patch [1/6] has been reworked. v9: - Delete several

[Xen-devel] [PATCH v11 2/6] VT-d: Introduce new fields in msi_desc to track binding with guest interrupt

2017-03-29 Thread Chao Gao
remap_entry() to update IRTE to posted format. Signed-off-by: Feng Wu Signed-off-by: Chao Gao --- v11: - Commit message changes. - Add code to clear the two new fields introduced in this patch. v10: - Newly added. xen/arch/x86/msi.c | 1 + xen/drivers/passthrough/io.c

[Xen-devel] [PATCH v11 4/6] VMX: Fixup PI descriptor when cpu is offline

2017-03-29 Thread Chao Gao
From: Feng Wu When cpu is offline, we need to move all the vcpus in its blocking list to another online cpu, this patch handles it. Signed-off-by: Feng Wu Signed-off-by: Chao Gao Reviewed-by: Jan Beulich Acked-by: Kevin Tian --- xen/arch/x86/hvm/vmx/vmcs.c | 1 + xen/arch/x86/hvm

[Xen-devel] [PATCH v11 1/6] passthrough: don't migrate pirq when it is delivered through VT-d PI

2017-03-29 Thread Chao Gao
migration so pirq directly injected to guest needn't be migrated. This patch adds a indicator, @posted, to show whether the pt irq is delivered through VT-d PI. Signed-off-by: Chao Gao --- v11: - rename the indicator to 'posted' - move setting 'posted' field to event lo

[Xen-devel] [PATCH v11 6/6] passthrough/io: Fall back to remapping interrupt when we can't use VT-d PI

2017-03-29 Thread Chao Gao
when guest wrongly configurate destination of pirq or makes it have multi-destination vcpus. Signed-off-by: Chao Gao Reviewed-by: Jan Beulich Reviewed-by: Kevin Tian --- v11: - move the code (one line) that allow the parameter 'vcpu' of pi_update_irte() can be NULL to Patch [2/6]. v10

[Xen-devel] [PATCH v11 5/6] VT-d: introduce update_irte to update irte safely

2017-03-29 Thread Chao Gao
irte. Both variants will update IRTE if possible. If the caller requests a atomic update but we can't meet it, we raise a bug. Signed-off-by: Chao Gao --- v11: - Add two variant function to update IRTE. Call the non-atomic one for init and clear operations. Call the atomic one for other

<    1   2   3   >