[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 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 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 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 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 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 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 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 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 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 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 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 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 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

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

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 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

[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 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 >>>

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 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 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 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 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 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 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 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 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 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 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 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 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); >

[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] 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] 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] [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

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 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] 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

[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] [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

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 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 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-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 v2 1/4] x86/dom0: prevent access to MMCFG areas for PVH Dom0

2017-08-31 Thread Chao Gao
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: >> > From: Roger Pau Monne [mailto:roger@citrix.com] >> > Sent: Friday, August 25, 2017 9:59 PM >> > >> > On Fri, Aug 25, 2017 at 06:25:36AM -0600, Jan Beulich wrote:

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 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, wrote: @@ -100,6 +101,24 @@ void vmx_pi_per_cpu_init(unsigned int cpu) spin_lock_init(&per_cpu

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

2017-08-30 Thread Chao Gao
On Wed, Aug 30, 2017 at 10:00:49AM -0600, Jan Beulich wrote: On 16.08.17 at 07:14, wrote: >> @@ -100,6 +101,24 @@ void vmx_pi_per_cpu_init(unsigned int cpu) >> spin_lock_init(&per_cpu(vmx_pi_blocking, cpu).lock); >> } >> >> +static void vmx_pi_add_vcpu(struct pi_blocking_vcpu *pbv, >>

Re: [Xen-devel] [PATCH v10] VT-d: use correct BDF for VF to search VT-d unit

2017-08-28 Thread Chao Gao
'Extended Funcion'. >> But it is conceptually wrong w/o checking whether PF is an extended >> function and would lead to match VFs of a RC integrated PF to a wrong >> VT-d unit. >> >> This patch overrides VF 'is_extfn' field and uses this field to

[Xen-devel] [PATCH v10] VT-d: use correct BDF for VF to search VT-d unit

2017-08-27 Thread Chao Gao
27;is_extfn' field and uses this field to indicate whether the PF of this VF is an extended function. The field helps to use correct BDF to search VT-d unit. Reported-by: Crawford, Eric R Signed-off-by: Chao Gao --- v10: - move setting vf's is_extfn closer to the place where we set

Re: [Xen-devel] [PATCH RESEND v9] VT-d: use correct BDF for VF to search VT-d unit

2017-08-25 Thread Chao Gao
an extended function and >>>> would lead to match VFs of a RC endpoint to a wrong VT-d unit. >>>> >>>> This patch uses VF's 'is_extfn' field to indicate whether the PF of this >>>> VF >>>> is >>>> an extended functio

Re: [Xen-devel] [PATCH RESEND v9] VT-d: use correct BDF for VF to search VT-d unit

2017-08-25 Thread Chao Gao
t;> is conceptually wrong w/o checking whether PF is an extended function and >> would lead to match VFs of a RC endpoint to a wrong VT-d unit. >> >> This patch uses VF's 'is_extfn' field to indicate whether the PF of this VF >> is >> an extended functi

Re: [Xen-devel] [PATCH V2 25/25] x86/vvtd: save and restore emulated VT-d

2017-08-25 Thread Chao Gao
On Fri, Aug 25, 2017 at 03:00:32AM -0600, Jan Beulich wrote: >>>> On 25.08.17 at 08:35, wrote: >> On Wed, Aug 23, 2017 at 01:19:41PM +0100, Roger Pau Monné wrote: >>>On Wed, Aug 09, 2017 at 04:34:26PM -0400, Lan Tianyu wrote: >>>> From: Chao Gao >

Re: [Xen-devel] [PATCH V2 21/25] tools/libxc: Add a new interface to bind remapping format msi with pirq

2017-08-25 Thread Chao Gao
On Wed, Aug 23, 2017 at 11:41:25AM +0100, Roger Pau Monné wrote: >On Wed, Aug 09, 2017 at 04:34:22PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Introduce a new binding relationship and provide a new interface to >> manage the new relationship. >> >>

Re: [Xen-devel] [PATCH V2 23/25] x86/vvtd: Handle interrupt translation faults

2017-08-25 Thread Chao Gao
On Wed, Aug 23, 2017 at 12:51:27PM +0100, Roger Pau Monné wrote: >On Wed, Aug 09, 2017 at 04:34:24PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Interrupt translation faults are non-recoverable fault. When faults > ^

Re: [Xen-devel] [PATCH V2 25/25] x86/vvtd: save and restore emulated VT-d

2017-08-25 Thread Chao Gao
On Wed, Aug 23, 2017 at 01:19:41PM +0100, Roger Pau Monné wrote: >On Wed, Aug 09, 2017 at 04:34:26PM -0400, Lan Tianyu wrote: >> From: Chao Gao >> >> Wrap some useful status in a new structure hvm_hw_vvtd, following >> the customs of vlapic, vioapic and etc. Provide t

[Xen-devel] [PATCH RESEND v9] VT-d: use correct BDF for VF to search VT-d unit

2017-08-24 Thread Chao Gao
PF of this VF is an extended function. The field helps to use correct BDF to search VT-d unit. Reported-by: Crawford, Eric R Signed-off-by: Chao Gao --- - RESEND for the previous email has no subject. v9: - check 'is_virtfn' first in pci_add_device() to avoid potential error

Re: [Xen-devel] [PATCH v8] VT-d: use correct BDF for VF to search VT-d unit

2017-08-24 Thread Chao Gao
I have sent out a new version, let's skip this one. Thanks Chao On Fri, Aug 25, 2017 at 12:17:15PM +0800, Chao Gao wrote: >When SR-IOV is enabled, 'Virtual Functions' of a 'Physical Function' are under >the scope of the same VT-d unit as the 'Physical Functi

[Xen-devel] (no subject)

2017-08-24 Thread Chao Gao
From 3aa2541108f28cfdf0f3bf47ddae9b762b73b532 Mon Sep 17 00:00:00 2001 From: Chao Gao Date: Mon, 7 Aug 2017 04:50:04 +0800 Subject: [PATCH v9] VT-d: use correct BDF for VF to search VT-d unit When SR-IOV is enabled, 'Virtual Functions' of a 'Physical Function' are under the

[Xen-devel] [PATCH v8] VT-d: use correct BDF for VF to search VT-d unit

2017-08-24 Thread Chao Gao
info to indicate whether the PF of this VF is an extended function. The field helps to use correct BDF to search VT-d unit. Reported-by: Crawford, Eric R Signed-off-by: Chao Gao --- v8: - use "conceptually wrong", instead of "a corner case" in commit message - check 'is_

Re: [Xen-devel] [PATCH XEN] x86/pt: add a MSI unmask flag to XEN_DOMCTL_bind_pt_irq

2017-08-24 Thread Chao Gao
On Thu, Aug 24, 2017 at 04:17:32AM -0600, Jan Beulich wrote: On 24.08.17 at 12:12, wrote: >> On Thu, Aug 24, 2017 at 04:07:40AM -0600, Jan Beulich wrote: >>> >>> On 24.08.17 at 11:47, wrote: >>> > @@ -438,6 +439,22 @@ int pt_irq_create_bind( >>> > pi_update_irte(vcpu ? &vcpu->ar

Re: [Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-24 Thread Chao Gao
On Thu, Aug 24, 2017 at 02:22:47AM -0600, Jan Beulich wrote: On 24.08.17 at 10:01, wrote: >>> From: Tian, Kevin >>> Sent: Thursday, August 24, 2017 3:22 PM >>> >>> > From: Gao, Chao >>> > Sent: Tuesday, August 22, 2017 5:52 AM >>> > >>> > When SR-IOV is enabled, 'Virtual Functions' of a 'Ph

Re: [Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-23 Thread Chao Gao
On Wed, Aug 23, 2017 at 09:01:07AM +0100, Roger Pau Monné wrote: >On Wed, Aug 23, 2017 at 02:46:08PM +0800, Chao Gao wrote: >> On Wed, Aug 23, 2017 at 08:31:51AM +0100, Roger Pau Monné wrote: >> >On Wed, Aug 23, 2017 at 01:20:13AM -0600, Jan Beulich wrote: >> >> &g

Re: [Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-23 Thread Chao Gao
On Wed, Aug 23, 2017 at 02:04:24AM -0600, Jan Beulich wrote: On 23.08.17 at 03:05, wrote: >> Strictly speaking, the VF can be an extended function. The definition is >> within ARI device (in this kind of device, device field is treated as an >> extension of function number) and function numbe

Re: [Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-23 Thread Chao Gao
On Wed, Aug 23, 2017 at 08:31:51AM +0100, Roger Pau Monné wrote: >On Wed, Aug 23, 2017 at 01:20:13AM -0600, Jan Beulich wrote: >> >>> On 23.08.17 at 09:16, wrote: >> > On Wed, Aug 23, 2017 at 09:05:14AM +0800, Chao Gao wrote: >> >> On Tue, Aug 22, 2017

Re: [Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-22 Thread Chao Gao
On Tue, Aug 22, 2017 at 06:43:49AM -0600, Jan Beulich wrote: On 21.08.17 at 23:52, wrote: >> --- a/xen/include/xen/pci.h >> +++ b/xen/include/xen/pci.h >> @@ -39,6 +39,10 @@ >> #define PCI_SBDF3(s,b,df) s) & 0x) << 16) | PCI_BDF2(b, df)) >> >> struct pci_dev_info { >> +/* >> +

Re: [Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-22 Thread Chao Gao
On Tue, Aug 22, 2017 at 08:29:58AM +0100, Roger Pau Monné wrote: >On Tue, Aug 22, 2017 at 05:52:04AM +0800, Chao Gao wrote: >> When SR-IOV is enabled, 'Virtual Functions' of a 'Physical Function' are >> under >> the scope of the same VT-d unit as the &#x

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

2017-08-21 Thread Chao Gao
used. >> >> This patch introduces a new field, pf_is_extfn, in struct >> pci_dev_info, to indicate whether the physical function is an extended >> function. The new field helps to generate correct BDF to search VT-d >> unit. >> >> Reported-by: Crawford,

[Xen-devel] [PATCH v7] VT-d: use correct BDF for VF to search VT-d unit

2017-08-21 Thread Chao Gao
info to indicate whether the PF of this VF is an extended function. The field helps to use correct BDF to search VT-d unit. Reported-by: Crawford, Eric R Signed-off-by: Chao Gao --- v7: - Drop Eric's tested-by - Change commit message to be clearer - Re-use VF's is_extfn field - ac

Re: [Xen-devel] [PATCH V2 9/25] tools/libxl: build DMAR table for a guest with one virtual VTD

2017-08-17 Thread Chao Gao
On Thu, Aug 17, 2017 at 01:28:21PM +0100, Wei Liu wrote: >On Thu, Aug 17, 2017 at 12:32:17PM +0100, Wei Liu wrote: >> On Wed, Aug 09, 2017 at 04:34:10PM -0400, Lan Tianyu wrote: >> > diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c >> > index f54fd49..94c9196 100644 >> > --- a/tools/l

Re: [Xen-devel] [patch v6] vt-d: fix vf of rc integrated pf matched to wrong vt-d unit

2017-08-16 Thread Chao Gao
On Wed, Aug 16, 2017 at 09:17:46AM +0100, Roger Pau Monné wrote: >on wed, aug 16, 2017 at 01:12:24pm +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. >> >> if a

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

2017-08-15 Thread Chao Gao
In order to analyze PI blocking list operation frequence and obtain the list length, add some relevant events to xentrace and some associated code in xenalyze. Signed-off-by: Chao Gao --- v5: - Put pi list operation under HW events and get rid of ASYNC stuff - generate scatterplot of pi list

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

2017-08-15 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 --- v5: - introduce two functions for adding or removing vcpus from pi blocking list. - check the sanity of vcpu count on pi blocking list v4: - non

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

2017-08-15 Thread Chao Gao
s.gt.net/xen/devel/472749?search_string=enable%20vt-d%20pi%20by%20default;#472749 Chao Gao (4): VT-d PI: track the number of vcpus on pi blocking list x86/vcpu: track hvm vcpu number on the system VT-d PI: restrict the number of vcpus in a given pcpu's PI blocking list xentrace: add

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

2017-08-15 Thread Chao Gao
This number is used to calculate the average vcpus per pcpu ratio. Signed-off-by: Chao Gao Acked-by: Jan Beulich --- 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

[Xen-devel] [PATCH v5 3/4] VT-d PI: restrict the number of vcpus in a given pcpu's PI blocking list

2017-08-15 Thread Chao Gao
f 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 --- v5: - Introduce a function to

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

2017-08-15 Thread Chao Gao
the real BDF should be used. This patch introduces a new field, pf_is_extfn, in struct pci_dev_info, to indicate whether the physical function is an extended function. The new field helps to generate correct BDF to search VT-d unit. Reported-by: Crawford, Eric R Tested-by: Crawford, Eric R Signed

[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 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] [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

  1   2   3   >