[Xen-devel] [PATCH v2 for-4.9 4/6] x86/svm: Introduce svm_emul_swint_injection()

2017-04-05 Thread Andrew Cooper
Software events require emulation in some cases on AMD hardware. Introduce svm_emul_swint_injection() to perform this emulation if necessary in svm_inject_event(), which will cope with any sources of event, rather than just those coming from x86_emulate(). This logic mirrors inject_swint() in the

[Xen-devel] [PATCH v2 for-4.9 2/6] x86/hvm: Correct long mode predicate

2017-04-05 Thread Andrew Cooper
hvm_long_mode_enabled() tests for EFER.LMA, which is specifically different to EFER.LME. Rename it to match its behaviour, and have it strictly return a boolean value (although all its callers already use it in implicitly-boolean contexts, so no functional change). Signed-off-by: Andrew Cooper R

[Xen-devel] [PATCH v2 for-4.9 6/6] x86/emul: Require callers to provide LMA in the emulation context

2017-04-05 Thread Andrew Cooper
Long mode (or not) influences emulation behaviour in a number of cases. Instead of reusing the ->read_msr() hook to obtain EFER.LMA, require callers to provide it directly. This simplifies all long mode checks during emulation to a simple boolean read, removing embedded msr reads. It also allows

[Xen-devel] [PATCH v2 for-4.9 0/6] x86/emul: Fixes

2017-04-05 Thread Andrew Cooper
This series started out as patches 4 and 5, to aid the userspace fuzzing harness, but ended up discovering the bug in patch 3, which is security relevant. Patch 3 is a must-fix for Xen 4.9, before the bug needs an XSA. Patches 4-6 are nice-to-have. The main change from v1 is reworking of patch 3

Re: [Xen-devel] [PATCH v10 5/6] x86/ioreq server: Asynchronously reset outstanding p2m_ioreq_server entries.

2017-04-05 Thread Yu Zhang
On 4/6/2017 1:18 AM, Yu Zhang wrote: On 4/6/2017 1:01 AM, George Dunlap wrote: On 05/04/17 17:32, Yu Zhang wrote: On 4/6/2017 12:35 AM, George Dunlap wrote: On 05/04/17 17:22, Yu Zhang wrote: On 4/5/2017 10:41 PM, George Dunlap wrote: On Sun, Apr 2, 2017 at 1:24 PM, Yu Zhang wrote: A

Re: [Xen-devel] [PATCH v6] altp2m: Introduce external-only and limited use-cases

2017-04-05 Thread Tamas K Lengyel
On Wed, Apr 5, 2017 at 9:04 AM, George Dunlap wrote: > On Tue, Apr 4, 2017 at 4:24 PM, Tamas K Lengyel > wrote: >> Currently setting altp2mhvm=1 in the domain configuration allows access to >> the >> altp2m interface for both in-guest and external privileged tools. This poses >> a problem for us

[Xen-devel] [PATCH v2 for-4.9 4/7] tools/insn-fuzz: Fix a stability bug in afl-clang-fast mode

2017-04-05 Thread Andrew Cooper
The fuzzing harness conditionally disables hooks to test error paths in the emulator. However, fuzz_emulops is a static structure. c/s 69f4633 "tools/insn-fuzz: Support AFL's afl-clang-fast mode" introduced persistent mode, but because fuzz_emulops is static, the clobbering of hooks accumulates o

[Xen-devel] [PATCH v2 for-4.9 2/7] tools/insn-fuzz: Don't hit memcpy() for zero-length reads

2017-04-05 Thread Andrew Cooper
For control-flow changes, the emulator needs to perform a zero-length instruction fetch at the target offset. It also passes NULL for the destination buffer, as there is no instruction stream to collect. This trips up UBSAN when passed to memcpy(), as passing NULL is undefined behaviour per the C

[Xen-devel] [PATCH v2 for-4.9 3/7] tools/insn-fuzz: Avoid making use of static data

2017-04-05 Thread Andrew Cooper
AFL has a measure of stability, where it passes the same corpus into the fuzzing harness and observes whether the execution path changes from before. Any instability in the fuzzing harness reduces its effectiveness, as an observed crash may not reliably be caused by the original corpus. In prepara

[Xen-devel] [PATCH v2 for-4.9 5/7] tools/insn-fuzz: Correct hook prototypes, and assert() appropriate segments

2017-04-05 Thread Andrew Cooper
The correct prototypes for the hooks are to use enum x86_segment rather than unsigned int. It is implementation specific as to whether this compiles. assert() that the emulator never passes an inappropriate segment. The only hook which may legitimately be passed x86_seg_none is invlpg(). Signed

[Xen-devel] [PATCH v2 for-4.9 7/7] tools/insn-fuzz: Fix assertion failures in x86_emulate_wrapper()

2017-04-05 Thread Andrew Cooper
c/s 92cf67888 "x86/emul: Hold x86_emulate() to strict X86EMUL_EXCEPTION requirements" was appropriate for the hypervisor, but the fuzzer stubs didn't conform to the stricter requirements. AFL is very quick to discover this. Extend the fuzzing harness exception logic to raise exceptions appropriat

[Xen-devel] [PATCH v2 for-4.9 6/7] tools/insn-fuzz: Provide IA32_DEBUGCTL consistently to the emulator

2017-04-05 Thread Andrew Cooper
x86_emulates()'s is_branch_step() performs a speculative read of IA32_DEBUGCTL, but doesn't squash exceptions should they arise. In reality, this MSR is always available. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: George Dunlap CC: Ian Jackson CC: Wei Liu --- tools/fuzz/x

[Xen-devel] [PATCH v2 for-4.9 1/7] MAINTAINERS: Move the x86 instruction emulator under x86 maintainership

2017-04-05 Thread Andrew Cooper
Requested-by: Jan Beulich Signed-off-by: Andrew Cooper -- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index c38bc

[Xen-devel] [PATCH v2 for-4.9 0/7] x86/emul: Userspace fuzzing harness fixes

2017-04-05 Thread Andrew Cooper
This is a subset of the previous fuzzing bugfix/improvement series, which is the minimum required to avoid hitting assertions in the emulator. From a 4.9 point of view, this entirely userspace testing harness changes (so safe to take), but it allows us to sensibly fuzz the emulator in the hypervis

[Xen-devel] [xen-4.5-testing test] 107205: tolerable FAIL - PUSHED

2017-04-05 Thread osstest service owner
flight 107205 xen-4.5-testing real [real] http://logs.test-lab.xenproject.org/osstest/logs/107205/ Failures :-/ but no regressions. Tests which are failing intermittently (not blocking): test-amd64-amd64-xl-qemuu-debianhvm-amd64 3 host-install(3) broken in 107183 pass in 107205 test-amd64-amd6

Re: [Xen-devel] [PATCH v10 5/6] x86/ioreq server: Asynchronously reset outstanding p2m_ioreq_server entries.

2017-04-05 Thread Yu Zhang
On 4/6/2017 1:28 AM, Yu Zhang wrote: On 4/6/2017 1:18 AM, Yu Zhang wrote: On 4/6/2017 1:01 AM, George Dunlap wrote: On 05/04/17 17:32, Yu Zhang wrote: On 4/6/2017 12:35 AM, George Dunlap wrote: On 05/04/17 17:22, Yu Zhang wrote: On 4/5/2017 10:41 PM, George Dunlap wrote: On Sun, Apr 2

[Xen-devel] [PATCH] arm64: xen: Implement EFI reset_system callback

2017-04-05 Thread Julien Grall
When rebooting DOM0 with ACPI, the kernel is crashing with the stack trace [1]. This is happening because when EFI runtimes are enabled, the reset code (see machin_restart) will first try to use EFI restart method. However, the EFI restart code is expecting the reset_system callback to be always

Re: [Xen-devel] [PATCH v10 5/6] x86/ioreq server: Asynchronously reset outstanding p2m_ioreq_server entries.

2017-04-05 Thread Yu Zhang
On 4/6/2017 2:02 AM, Yu Zhang wrote: On 4/6/2017 1:28 AM, Yu Zhang wrote: On 4/6/2017 1:18 AM, Yu Zhang wrote: On 4/6/2017 1:01 AM, George Dunlap wrote: On 05/04/17 17:32, Yu Zhang wrote: On 4/6/2017 12:35 AM, George Dunlap wrote: On 05/04/17 17:22, Yu Zhang wrote: On 4/5/2017 10:4

Re: [Xen-devel] [Outreachy] Doubts regarding setup, git version and selection of micro task

2017-04-05 Thread Stefano Stabellini
On Wed, 5 Apr 2017, Julien Grall wrote: > (CC Lars) > > Hi, > > On 05/04/17 12:51, Wei Liu wrote: > > On Wed, Apr 05, 2017 at 05:04:00PM +0530, Tejaswini Poluri wrote: > > > Hi Stefano and Julien, > > > > > > This is Tejaswini. I had been working as a Senior Software developer in > > > Samsung a

Re: [Xen-devel] [PATCH V2] libxc: fix xc_translate_foreign_address()

2017-04-05 Thread Julien Grall
On 05/04/17 16:03, Wei Liu wrote: On Wed, Apr 05, 2017 at 03:58:05PM +0100, Julien Grall wrote: Hi Razvan, On 05/04/17 15:53, Razvan Cojocaru wrote: Currently xc_translate_foreign_address() only checks for the PSE bit on level 2 entries (that's 2 MB pages on x64 and 32-bit with PAE, and 4 MB

Re: [Xen-devel] [PATCH v2 for-4.9 2/6] x86/hvm: Correct long mode predicate

2017-04-05 Thread Boris Ostrovsky
On 04/05/2017 01:33 PM, Andrew Cooper wrote: > hvm_long_mode_enabled() tests for EFER.LMA, which is specifically different to > EFER.LME. > > Rename it to match its behaviour, and have it strictly return a boolean value > (although all its callers already use it in implicitly-boolean contexts, so n

Re: [Xen-devel] [PATCH v2 for-4.9 4/6] x86/svm: Introduce svm_emul_swint_injection()

2017-04-05 Thread Boris Ostrovsky
On 04/05/2017 01:33 PM, Andrew Cooper wrote: > Software events require emulation in some cases on AMD hardware. Introduce > svm_emul_swint_injection() to perform this emulation if necessary in > svm_inject_event(), which will cope with any sources of event, rather than > just those coming from x86

Re: [Xen-devel] [PATCH v2 for-4.9 4/6] x86/svm: Introduce svm_emul_swint_injection()

2017-04-05 Thread Andrew Cooper
On 05/04/17 19:58, Boris Ostrovsky wrote: > On 04/05/2017 01:33 PM, Andrew Cooper wrote: >> Software events require emulation in some cases on AMD hardware. Introduce >> svm_emul_swint_injection() to perform this emulation if necessary in >> svm_inject_event(), which will cope with any sources of

[Xen-devel] [PATCH v7 1/7] xen: import new ring macros in ring.h

2017-04-05 Thread Stefano Stabellini
Sync the ring.h file with upstream Xen, to introduce the new ring macros. They will be used by the Xen transport for 9pfs. Signed-off-by: Stefano Stabellini CC: konrad.w...@oracle.com CC: boris.ostrov...@oracle.com CC: jgr...@suse.com CC: gr...@kaod.org --- NB: The new macros have been committed

[Xen-devel] [PATCH v7 3/7] xen/9pfs: introduce Xen 9pfs transport driver

2017-04-05 Thread Stefano Stabellini
Introduce the Xen 9pfs transport driver: add struct xenbus_driver to register as a xenbus driver and add struct p9_trans_module to register as v9fs driver. All functions are empty stubs for now. Signed-off-by: Stefano Stabellini Reviewed-by: Boris Ostrovsky Reviewed-by: Juergen Gross CC: gr...

[Xen-devel] [PATCH v7 7/7] xen/9pfs: build 9pfs Xen transport driver

2017-04-05 Thread Stefano Stabellini
This patch adds a Kconfig option and Makefile support for building the 9pfs Xen driver. Signed-off-by: Stefano Stabellini Reviewed-by: Juergen Gross CC: gr...@kaod.org CC: boris.ostrov...@oracle.com CC: jgr...@suse.com CC: Eric Van Hensbergen CC: Ron Minnich CC: Latchesar Ionkov CC: v9fs-deve

[Xen-devel] [PATCH v7 2/7] xen: introduce the header file for the Xen 9pfs transport protocol

2017-04-05 Thread Stefano Stabellini
It uses the new ring.h macros to declare rings and interfaces. Signed-off-by: Stefano Stabellini CC: konrad.w...@oracle.com CC: boris.ostrov...@oracle.com CC: jgr...@suse.com CC: gr...@kaod.org --- include/xen/interface/io/9pfs.h | 36 1 file changed, 36 inse

[Xen-devel] [PATCH v7 5/7] xen/9pfs: send requests to the backend

2017-04-05 Thread Stefano Stabellini
Implement struct p9_trans_module create and close functions by looking at the available Xen 9pfs frontend-backend connections. We don't expect many frontend-backend connections, thus walking a list is OK. Send requests to the backend by copying each request to one of the available rings (each fron

[Xen-devel] [PATCH v7 0/7] Xen transport for 9pfs frontend driver

2017-04-05 Thread Stefano Stabellini
Hi all, This patch series implements a new transport for 9pfs, aimed at Xen systems. The transport is based on a traditional Xen frontend and backend drivers pair. This patch series implements the frontend, which typically runs in a regular unprivileged guest. I also sent a series that implement

[Xen-devel] [PATCH v7 4/7] xen/9pfs: connect to the backend

2017-04-05 Thread Stefano Stabellini
Implement functions to handle the xenbus handshake. Upon connection, allocate the rings according to the protocol specification. Initialize a work_struct and a wait_queue. The work_struct will be used to schedule work upon receiving an event channel notification from the backend. The wait_queue wi

[Xen-devel] [PATCH v7 6/7] xen/9pfs: receive responses

2017-04-05 Thread Stefano Stabellini
Upon receiving a notification from the backend, schedule the p9_xen_response work_struct. p9_xen_response checks if any responses are available, if so, it reads them one by one, calling p9_client_cb to send them up to the 9p layer (p9_client_cb completes the request). Handle the ring following the

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

2017-04-05 Thread Stefano Stabellini
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 accessing > memory mapped HW in a non-conventional way. In the patches for XSA-201, > we crash the guest when

[Xen-devel] [libvirt test] 107207: regressions - FAIL

2017-04-05 Thread osstest service owner
flight 107207 libvirt real [real] http://logs.test-lab.xenproject.org/osstest/logs/107207/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-armhf-armhf-libvirt-xsm 6 xen-boot fail REGR. vs. 106829 Regressions which are r

[Xen-devel] [PATCH v3 09/13] qobject: Use simpler QDict/QList scalar insertion macros

2017-04-05 Thread Eric Blake
We now have macros in place to make it less verbose to add a scalar to QDict and QList, so use them. To make this patch smaller to review, a couple of subdirectories were done in earlier patches. Patch created mechanically via: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-fil

Re: [Xen-devel] [PATCH] arm64: xen: Implement EFI reset_system callback

2017-04-05 Thread Boris Ostrovsky
On 04/05/2017 02:14 PM, Julien Grall wrote: > When rebooting DOM0 with ACPI, the kernel is crashing with the stack trace > [1]. > > This is happening because when EFI runtimes are enabled, the reset code > (see machin_restart) will first try to use EFI restart method. > > However, the EFI restart

[Xen-devel] [PATCH v2] x86/vpmu_intel: Handle SMT consistently for programmable and fixed counters

2017-04-05 Thread Mohit Gambhir
The patch introduces a macro FIXED_CTR_CTRL_ANYTHREAD_MASK and uses it to mask .Anythread bit for all counter in IA32_FIXED_CTR_CTRL MSR in all versions of Intel Arhcitectural Performance Monitoring. Masking .AnyThread bit is necesssry for two reasons: 1. We need to be consistent in the implemen

[Xen-devel] [PATCH v7 2/2] vgic: refuse irq migration when one is already in progress

2017-04-05 Thread Stefano Stabellini
When an irq migration is already in progress, but not yet completed (GIC_IRQ_GUEST_MIGRATING is set), refuse any other irq migration requests for the same irq. This patch implements this approach by returning success or failure from vgic_migrate_irq, and avoiding irq target changes on failure. It

[Xen-devel] [PATCH v7 0/2] xen/arm: remove race conditions in irq migration

2017-04-05 Thread Stefano Stabellini
Hi all, this patch series removes three race conditions affecting the current code base. The first race condition is between gic_update_one_lr and vgic_vcpu_inject_irq: as soon as gic_update_one_lr calls irq_set_affinity a new interrupt could be injected in the new pcpu, eventually vgic_vcpu_inje

[Xen-devel] [PATCH v7 1/2] arm: remove irq from inflight, then change physical affinity

2017-04-05 Thread Stefano Stabellini
This patch fixes a potential race that could happen when gic_update_one_lr and vgic_vcpu_inject_irq run simultaneously. When GIC_IRQ_GUEST_MIGRATING is set, we must make sure that the irq has been removed from inflight before changing physical affinity, to avoid concurrent accesses to p->inflight,

Re: [Xen-devel] [PATCH] arm64: xen: Implement EFI reset_system callback

2017-04-05 Thread Stefano Stabellini
On Wed, 5 Apr 2017, Julien Grall wrote: > When rebooting DOM0 with ACPI, the kernel is crashing with the stack trace > [1]. > > This is happening because when EFI runtimes are enabled, the reset code > (see machin_restart) will first try to use EFI restart method. > > However, the EFI restart co

[Xen-devel] [qemu-mainline baseline-only test] 71151: regressions - trouble: blocked/broken/fail/pass

2017-04-05 Thread Platform Team regression test user
This run is configured for baseline tests only. flight 71151 qemu-mainline real [real] http://osstest.xs.citrite.net/~osstest/testlogs/logs/71151/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 9 win

[Xen-devel] [PATCH v5 24/30] ARM: vITS: handle MOVI command

2017-04-05 Thread Andre Przywara
The MOVI command moves the interrupt affinity from one redistributor (read: VCPU) to another. For now migration of "live" LPIs is not yet implemented, but we store the changed affinity in the host LPI structure and in our virtual ITTE. Signed-off-by: Andre Przywara --- xen/arch/arm/gic-v3-its.c

[Xen-devel] [PATCH v5 07/30] ARM: GICv3 ITS: map ITS command buffer

2017-04-05 Thread Andre Przywara
Instead of directly manipulating the tables in memory, an ITS driver sends commands via a ring buffer in normal system memory to the ITS h/w to create or alter the LPI mappings. Allocate memory for that buffer and tell the ITS about it to be able to send ITS commands. Signed-off-by: Andre Przywara

[Xen-devel] [PATCH v5 15/30] ARM: vGICv3: handle virtual LPI pending and property tables

2017-04-05 Thread Andre Przywara
Allow a guest to provide the address and size for the memory regions it has reserved for the GICv3 pending and property tables. We sanitise the various fields of the respective redistributor registers and map those pages into Xen's address space to have easy access. This introduces a function to re

[Xen-devel] [PATCH v5 27/30] ARM: vITS: handle INVALL command

2017-04-05 Thread Andre Przywara
The INVALL command instructs an ITS to invalidate the configuration data for all LPIs associated with a given redistributor (read: VCPU). This is nasty to emulate exactly with our architecture, so we just iterate over all mapped LPIs and filter for those from that particular VCPU. Signed-off-by: A

[Xen-devel] [PATCH v5 20/30] ARM: vITS: handle INT command

2017-04-05 Thread Andre Przywara
The INT command sets a given LPI identified by a DeviceID/EventID pair as pending and thus triggers it to be injected. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-its.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/xen/arch/arm/vgic-v3-its.c b/xen

[Xen-devel] [PATCH v5 30/30] ARM: vGIC: advertise LPI support

2017-04-05 Thread Andre Przywara
To let a guest know about the availability of virtual LPIs, set the respective bits in the virtual GIC registers and let a guest control the LPI enable bit. Only report the LPI capability if the host has initialized at least one ITS. This removes a "TBD" comment, as we now populate the processor nu

[Xen-devel] [PATCH v5 02/30] bitops: add BIT_ULL variant

2017-04-05 Thread Andre Przywara
To safely handle 64-bit registers even on 32-bit systems, introduce a BIT_ULL variant (lifted from Linux). Signed-off-by: Andre Przywara --- xen/include/asm-arm/bitops.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include/asm-arm/bitops.h b/xen/include/asm-arm/bitops.h index bda8898.

[Xen-devel] [PATCH v5 12/30] ARM: GICv3: introduce separate pending_irq structs for LPIs

2017-04-05 Thread Andre Przywara
For the same reason that allocating a struct irq_desc for each possible LPI is not an option, having a struct pending_irq for each LPI is also not feasible. We only care about mapped LPIs, so we can get away with having struct pending_irq's only for them. Maintain a radix tree per domain where we d

[Xen-devel] [PATCH v5 17/30] ARM: vITS: add command handling stub and MMIO emulation

2017-04-05 Thread Andre Przywara
Emulate the memory mapped ITS registers and provide a stub to introduce the ITS command handling framework (but without actually emulating any commands at this time). Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-its.c| 416 ++ xen/arch/arm/vg

[Xen-devel] [PATCH v5 05/30] ARM: GICv3: allocate LPI pending and property table

2017-04-05 Thread Andre Przywara
The ARM GICv3 provides a new kind of interrupt called LPIs. The pending bits and the configuration data (priority, enable bits) for those LPIs are stored in tables in normal memory, which software has to provide to the hardware. Allocate the required memory, initialize it and hand it over to each r

[Xen-devel] [PATCH v5 29/30] ARM: vITS: create ITS subnodes for Dom0 DT

2017-04-05 Thread Andre Przywara
Dom0 expects all ITSes in the system to be propagated to be able to use MSIs. Create Dom0 DT nodes for each hardware ITS, keeping the register frame address the same, as the doorbell address that the Dom0 drivers program into the BARs has to match the hardware. Signed-off-by: Andre Przywara ---

[Xen-devel] [PATCH v5 09/30] ARM: GICv3 ITS: introduce host LPI array

2017-04-05 Thread Andre Przywara
The number of LPIs on a host can be potentially huge (millions), although in practise will be mostly reasonable. So prematurely allocating an array of struct irq_desc's for each LPI is not an option. However Xen itself does not care about LPIs, as every LPI will be injected into a guest (Dom0 for n

[Xen-devel] [PATCH v5 03/30] ARM: GICv3 ITS: parse and store ITS subnodes from hardware DT

2017-04-05 Thread Andre Przywara
Parse the GIC subnodes in the device tree to find every ITS MSI controller the hardware offers. Store that information in a list to both propagate all of them later to Dom0, but also to be able to iterate over all ITSes. This introduces an ITS Kconfig option (as an EXPERT option), use XEN_CONFIG_EX

[Xen-devel] [PATCH v5 16/30] ARM: vGICv3: handle disabled LPIs

2017-04-05 Thread Andre Przywara
If a guest disables an LPI, we do not forward this to the associated host LPI to avoid queueing commands to the host ITS command queue. So it may happen that an LPI fires nevertheless on the host. In this case we can bail out early, but have to save the pending state on the virtual side. We do this

[Xen-devel] [PATCH v5 23/30] ARM: vITS: handle MAPTI command

2017-04-05 Thread Andre Przywara
The MAPTI commands associates a DeviceID/EventID pair with a LPI/CPU pair and actually instantiates LPI interrupts. We connect the already allocated host LPI to this virtual LPI, so that any triggering LPI on the host can be quickly forwarded to a guest. Beside entering the VCPU and the virtual LPI

[Xen-devel] [PATCH v5 21/30] ARM: vITS: handle MAPC command

2017-04-05 Thread Andre Przywara
The MAPC command associates a given collection ID with a given redistributor, thus mapping collections to VCPUs. We just store the vcpu_id in the collection table for that. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-its.c | 41 + 1 file changed

[Xen-devel] [PATCH v5 06/30] ARM: GICv3 ITS: allocate device and collection table

2017-04-05 Thread Andre Przywara
Each ITS maps a pair of a DeviceID (for instance derived from a PCI b/d/f triplet) and an EventID (the MSI payload or interrupt ID) to a pair of LPI number and collection ID, which points to the target CPU. This mapping is stored in the device and collection tables, which software has to provide fo

[Xen-devel] [PATCH v5 01/30] bitops: add GENMASK_ULL

2017-04-05 Thread Andre Przywara
To safely handle 64-bit registers even on 32-bit systems, introduce a GENMASK_ULL variant (lifted from Linux). This adds a BITS_PER_LONG_LONG define as well. Also fix a bug in the comment for the existing GENMASK variant. Signed-off-by: Andre Przywara --- xen/include/asm-arm/config.h | 2 ++ xen

[Xen-devel] [PATCH v5 22/30] ARM: vITS: handle MAPD command

2017-04-05 Thread Andre Przywara
The MAPD command maps a device by associating a memory region for storing ITEs with a certain device ID. We store the given guest physical address in the device table, and, if this command comes from Dom0, tell the host ITS driver about this new mapping, so it can issue the corresponding host MAPD

[Xen-devel] [PATCH v5 18/30] ARM: vITS: introduce translation table walks

2017-04-05 Thread Andre Przywara
The ITS stores the target (v)CPU and the (virtual) LPI number in tables. Introduce functions to walk those tables and translate an device ID - event ID pair into a pair of virtual LPI and vCPU. We map those tables on demand - which is cheap on arm64. Also we take care of the locking on the way, sin

[Xen-devel] [PATCH v5 04/30] ARM: GICv3 ITS: initialize host ITS

2017-04-05 Thread Andre Przywara
Map the registers frame for each host ITS and populate the host ITS structure with some parameters describing the size of certain properties like the number of bits for device IDs. Signed-off-by: Andre Przywara --- xen/arch/arm/gic-v3-its.c| 33 ++ xen/arch/ar

[Xen-devel] [PATCH v5 00/30] arm64: Dom0 ITS emulation

2017-04-05 Thread Andre Przywara
Hi, another round with lots of fixes for the ITS emulation series. The access to guest memory has been reworked, we now use a routine to copy to and from guest memory to also guarantee atomic access. This is courtesy of Vijaya Kumar, from a previous series. For a detailed changelog see below. Ope

[Xen-devel] [PATCH v5 14/30] ARM: GICv3: enable ITS and LPIs on the host

2017-04-05 Thread Andre Przywara
Now that the host part of the ITS code is in place, we can enable the ITS and also LPIs on each redistributor to get the show rolling. At this point there would be no LPIs mapped, as guests don't know about the ITS yet. Signed-off-by: Andre Przywara --- xen/arch/arm/gic-v3-its.c | 4 xen/a

[Xen-devel] [PATCH v5 13/30] ARM: GICv3: forward pending LPIs to guests

2017-04-05 Thread Andre Przywara
Upon receiving an LPI on the host, we need to find the right VCPU and virtual IRQ number to get this IRQ injected. Iterate our two-level LPI table to find this information quickly when the host takes an LPI. Call the existing injection function to let the GIC emulation deal with this interrupt. Als

[Xen-devel] [PATCH v5 26/30] ARM: vITS: handle INV command

2017-04-05 Thread Andre Przywara
The INV command instructs the ITS to update the configuration data for a given LPI by re-reading its entry from the property table. We don't need to care so much about the priority value, but enabling or disabling an LPI has some effect: We remove or push virtual LPIs to their VCPUs, also check the

[Xen-devel] [PATCH v5 25/30] ARM: vITS: handle DISCARD command

2017-04-05 Thread Andre Przywara
The DISCARD command drops the connection between a DeviceID/EventID and an LPI/collection pair. We mark the respective structure entries as not allocated and make sure that any queued IRQs are removed. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-its.c | 32

[Xen-devel] [PATCH v5 11/30] ARM: GICv3 ITS: introduce device mapping

2017-04-05 Thread Andre Przywara
The ITS uses device IDs to map LPIs to a device. Dom0 will later use those IDs, which we directly pass on to the host. For this we have to map each device that Dom0 may request to a host ITS device with the same identifier. Allocate the respective memory and enter each device into an rbtree to late

[Xen-devel] [PATCH v5 19/30] ARM: vITS: handle CLEAR command

2017-04-05 Thread Andre Przywara
This introduces the ITS command handler for the CLEAR command, which clears the pending state of an LPI. This removes a not-yet injected, but already queued IRQ from a VCPU. As read_itte() is now eventually used, we add the static keyword. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-i

[Xen-devel] [PATCH v5 28/30] ARM: vITS: create and initialize virtual ITSes for Dom0

2017-04-05 Thread Andre Przywara
For each hardware ITS create and initialize a virtual ITS for Dom0. We use the same memory mapped address to keep the doorbell working. This introduces a function to initialize a virtual ITS. We maintain a list of virtual ITSes, at the moment for the only purpose of later being able to free them ag

[Xen-devel] [PATCH v5 08/30] ARM: GICv3 ITS: introduce ITS command handling

2017-04-05 Thread Andre Przywara
To be able to easily send commands to the ITS, create the respective wrapper functions, which take care of the ring buffer. The first two commands we implement provide methods to map a collection to a redistributor (aka host core) and to flush the command queue (SYNC). Start using these commands fo

[Xen-devel] [PATCH v5 10/30] ARM: vGICv3: introduce ITS emulation stub

2017-04-05 Thread Andre Przywara
Create a new file to hold the emulation code for the ITS widget. This just holds the data structure and a init and free function for now. Signed-off-by: Andre Przywara --- xen/arch/arm/Makefile| 1 + xen/arch/arm/vgic-v3-its.c | 85 xen

Re: [Xen-devel] [PATCH v4 23/27] ARM: vITS: handle INV command

2017-04-05 Thread André Przywara
On 04/04/17 17:51, Julien Grall wrote: > Hi Andre, > > On 03/04/17 21:28, Andre Przywara wrote: >> The INV command instructs the ITS to update the configuration data for >> a given LPI by re-reading its entry from the property table. >> We don't need to care so much about the priority value, but e

Re: [Xen-devel] [PATCH v5 03/30] ARM: GICv3 ITS: parse and store ITS subnodes from hardware DT

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > Parse the GIC subnodes in the device tree to find every ITS MSI controller > the hardware offers. Store that information in a list to both propagate > all of them later to Dom0, but also to be able to iterate over all ITSes. > This introduces an ITS Kconf

Re: [Xen-devel] [PATCH v5 02/30] bitops: add BIT_ULL variant

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > To safely handle 64-bit registers even on 32-bit systems, introduce > a BIT_ULL variant (lifted from Linux). > > Signed-off-by: Andre Przywara Reviewed-by: Stefano Stabellini > --- > xen/include/asm-arm/bitops.h | 1 + > 1 file changed, 1 insertion(

Re: [Xen-devel] [PATCH v5 01/30] bitops: add GENMASK_ULL

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > To safely handle 64-bit registers even on 32-bit systems, introduce > a GENMASK_ULL variant (lifted from Linux). > This adds a BITS_PER_LONG_LONG define as well. > Also fix a bug in the comment for the existing GENMASK variant. > > Signed-off-by: Andre P

Re: [Xen-devel] [PATCH v5 04/30] ARM: GICv3 ITS: initialize host ITS

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > Map the registers frame for each host ITS and populate the host ITS > structure with some parameters describing the size of certain properties > like the number of bits for device IDs. > > Signed-off-by: Andre Przywara Reviewed-by: Stefano Stabellini

Re: [Xen-devel] [PATCH v5 05/30] ARM: GICv3: allocate LPI pending and property table

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The ARM GICv3 provides a new kind of interrupt called LPIs. > The pending bits and the configuration data (priority, enable bits) for > those LPIs are stored in tables in normal memory, which software has to > provide to the hardware. > Allocate the requi

Re: [Xen-devel] [PATCH v5 08/30] ARM: GICv3 ITS: introduce ITS command handling

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > To be able to easily send commands to the ITS, create the respective > wrapper functions, which take care of the ring buffer. > The first two commands we implement provide methods to map a collection > to a redistributor (aka host core) and to flush the c

Re: [Xen-devel] [PATCH v5 09/30] ARM: GICv3 ITS: introduce host LPI array

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The number of LPIs on a host can be potentially huge (millions), > although in practise will be mostly reasonable. So prematurely allocating > an array of struct irq_desc's for each LPI is not an option. > However Xen itself does not care about LPIs, as e

Re: [Xen-devel] [PATCH v5 11/30] ARM: GICv3 ITS: introduce device mapping

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The ITS uses device IDs to map LPIs to a device. Dom0 will later use > those IDs, which we directly pass on to the host. > For this we have to map each device that Dom0 may request to a host > ITS device with the same identifier. > Allocate the respective

Re: [Xen-devel] [PATCH v5 13/30] ARM: GICv3: forward pending LPIs to guests

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > Upon receiving an LPI on the host, we need to find the right VCPU and > virtual IRQ number to get this IRQ injected. > Iterate our two-level LPI table to find this information quickly when > the host takes an LPI. Call the existing injection function to l

Re: [Xen-devel] [PATCH v5 15/30] ARM: vGICv3: handle virtual LPI pending and property tables

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > Allow a guest to provide the address and size for the memory regions > it has reserved for the GICv3 pending and property tables. > We sanitise the various fields of the respective redistributor > registers and map those pages into Xen's address space to

Re: [Xen-devel] [PATCH v5 16/30] ARM: vGICv3: handle disabled LPIs

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > If a guest disables an LPI, we do not forward this to the associated > host LPI to avoid queueing commands to the host ITS command queue. > So it may happen that an LPI fires nevertheless on the host. In this > case we can bail out early, but have to save

[Xen-devel] [linux-linus test] 107206: regressions - FAIL

2017-04-05 Thread osstest service owner
flight 107206 linux-linus real [real] http://logs.test-lab.xenproject.org/osstest/logs/107206/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-armhf-armhf-xl-credit2 11 guest-start fail REGR. vs. 59254 test-armhf-armhf-xl

Re: [Xen-devel] [PATCH v5 17/30] ARM: vITS: add command handling stub and MMIO emulation

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > Emulate the memory mapped ITS registers and provide a stub to introduce > the ITS command handling framework (but without actually emulating any > commands at this time). > > Signed-off-by: Andre Przywara > --- > xen/arch/arm/vgic-v3-its.c| 416

Re: [Xen-devel] [PATCH v5 19/30] ARM: vITS: handle CLEAR command

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > This introduces the ITS command handler for the CLEAR command, which > clears the pending state of an LPI. > This removes a not-yet injected, but already queued IRQ from a VCPU. > As read_itte() is now eventually used, we add the static keyword. > > Sign

Re: [Xen-devel] [PATCH v5 22/30] ARM: vITS: handle MAPD command

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The MAPD command maps a device by associating a memory region for > storing ITEs with a certain device ID. > We store the given guest physical address in the device table, and, if > this command comes from Dom0, tell the host ITS driver about this new > m

Re: [Xen-devel] [PATCH v5 23/30] ARM: vITS: handle MAPTI command

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The MAPTI commands associates a DeviceID/EventID pair with a LPI/CPU > pair and actually instantiates LPI interrupts. > We connect the already allocated host LPI to this virtual LPI, so that > any triggering LPI on the host can be quickly forwarded to a g

Re: [Xen-devel] [PATCH v5 24/30] ARM: vITS: handle MOVI command

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The MOVI command moves the interrupt affinity from one redistributor > (read: VCPU) to another. > For now migration of "live" LPIs is not yet implemented, but we store > the changed affinity in the host LPI structure and in our virtual ITTE. > > Signed-o

Re: [Xen-devel] [PATCH v5 25/30] ARM: vITS: handle DISCARD command

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The DISCARD command drops the connection between a DeviceID/EventID > and an LPI/collection pair. > We mark the respective structure entries as not allocated and make > sure that any queued IRQs are removed. > > Signed-off-by: Andre Przywara > --- > xe

Re: [Xen-devel] [PATCH v5 26/30] ARM: vITS: handle INV command

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > The INV command instructs the ITS to update the configuration data for > a given LPI by re-reading its entry from the property table. > We don't need to care so much about the priority value, but enabling > or disabling an LPI has some effect: We remove o

Re: [Xen-devel] [PATCH v5 30/30] ARM: vGIC: advertise LPI support

2017-04-05 Thread Stefano Stabellini
On Thu, 6 Apr 2017, Andre Przywara wrote: > To let a guest know about the availability of virtual LPIs, set the > respective bits in the virtual GIC registers and let a guest control > the LPI enable bit. > Only report the LPI capability if the host has initialized at least > one ITS. > This remove

[Xen-devel] [xen-4.6-testing test] 107208: tolerable FAIL - PUSHED

2017-04-05 Thread osstest service owner
flight 107208 xen-4.6-testing real [real] http://logs.test-lab.xenproject.org/osstest/logs/107208/ Failures :-/ but no regressions. Tests which are failing intermittently (not blocking): test-amd64-i386-freebsd10-amd64 3 host-install(3) broken in 107186 pass in 107208 test-xtf-amd64-amd64-5 20

[Xen-devel] [xen-4.7-testing test] 107209: tolerable FAIL - PUSHED

2017-04-05 Thread osstest service owner
flight 107209 xen-4.7-testing real [real] http://logs.test-lab.xenproject.org/osstest/logs/107209/ Failures :-/ but no regressions. Tests which are failing intermittently (not blocking): test-amd64-amd64-pair 3 host-install/src_host(3) broken in 107185 pass in 107209 test-armhf-armhf-xl-credit

[Xen-devel] [xen-4.5-testing baseline-only test] 71152: tolerable FAIL

2017-04-05 Thread Platform Team regression test user
This run is configured for baseline tests only. flight 71152 xen-4.5-testing real [real] http://osstest.xs.citrite.net/~osstest/testlogs/logs/71152/ Failures :-/ but no regressions. Regressions which are regarded as allowable (not blocking): test-xtf-amd64-amd64-2 20 xtf/test-hvm32-invlpg~sha

[Xen-devel] Outreachy project - Xen Code Review Dashboard

2017-04-05 Thread Heather Booker
Hi! I'd love to work on the Code Review Dashboard project for this round of Outreachy. Are the steps outlined here http://markmail.org/message/7adkmords3imkswd still the first contribution you'd like to see? So is this a project that has been worked on in previous rounds of GSOC/Outreachy also?

Re: [Xen-devel] [PATCH v3 1/9] x86/mce: handle LMCE locally

2017-04-05 Thread Haozhong Zhang
On 03/31/17 01:24 -0600, Jan Beulich wrote: > >>> On 31.03.17 at 04:34, wrote: > > On 03/30/17 08:35 -0600, Jan Beulich wrote: > >> >>> On 30.03.17 at 08:19, wrote: > >> > --- a/xen/arch/x86/cpu/mcheck/mce.c > >> > +++ b/xen/arch/x86/cpu/mcheck/mce.c > >> > @@ -42,6 +42,13 @@ DEFINE_PER_CPU_READ_

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 accessing >> memory mapped

[Xen-devel] [PATCH 2/2] xen/mce: fix static variable 'severity_cpu'

2017-04-05 Thread Haozhong Zhang
1. Distinguish 'severity_cpu' used in mcheck_cmn_handler() and mce_softirq(), which should be different variables. Otherwise, they may interfere with each other if MC# comes during mce_softirq(). 2. Always (re-)initialize 'severity_cpu' to clear historical information. Signed-off-by: Haozhon

<    1   2   3   4   >