[Xen-devel] [PATCH 49/57] ARM: new VGIC: provide system register emulation stub

2018-03-05 Thread Andre Przywara
The Xen arch code traps system registers writes from the guest and will relay anything GIC related to the VGIC. Since this affects only GICv3 (which we don't yet emulate), provide a stub implementation of vgic_emulate() for now. Signed-off-by: Andre Przywara --- Changelog RFC ... v1:

[Xen-devel] [PATCH 05/57] ARM: vGICv3: always use architected redist stride

2018-03-05 Thread Andre Przywara
27;s GICv3 emulation. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Changelog RFC ... v1: - Add Julien's ACK xen/arch/arm/gic-v3.c | 4 xen/arch/arm/vgic-v3.c | 14 ++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xe

[Xen-devel] [PATCH 15/57] ARM: GICv2: Extend and adjust register definitions

2018-03-05 Thread Andre Przywara
actually deal with. Signed-off-by: Andre Przywara --- Changelog RFC ... v1: - extend commit message xen/arch/arm/gic-v2.c | 2 +- xen/include/asm-arm/gic.h | 18 -- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c

[Xen-devel] [PATCH 08/57] ARM: VGIC: Move gic_remove_from_lr_pending() prototype

2018-03-05 Thread Andre Przywara
The prototype for gic_remove_from_lr_pending() is the last function in gic.h which references a VGIC data structure. Move it over to vgic.h, so that we can remove the inclusion of vgic.h from gic.h. We add it to asm/domain.h instead, where it is actually needed. Signed-off-by: Andre Przywara

[Xen-devel] [FIXUP] replace LOG_2 with ilog2

2018-03-05 Thread Andre Przywara
The macro formerly named LOG_2 has been recently renamed to ilog2, so adjust the name in vgic-mmio.h. Signed-off-by: Andre Przywara --- Hi, I somehow rebased without actually trying to re-compile (since the rebase itself went through smoothly). So I missed this subtle renaming in the tree

Re: [Xen-devel] [PATCH 00/57] New VGIC(-v2) implementation

2018-03-05 Thread Andre Przywara
Hi, On 05/03/18 16:03, Andre Przywara wrote: > tl;dr: Coarse changelog below, individual patches have changelogs as > well. > > This is an updated version of the new VGIC-v2 implementation. For the brave amongst you who actually want to try it, there is a git repo with these patch

Re: [Xen-devel] [PATCH 20/57] ARM: GICv2: fix GICH_V2_LR definitions

2018-03-06 Thread Andre Przywara
Hi, On 06/03/18 15:46, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:03, Andre Przywara wrote: >> The bit definition for the CPUID mask in the GICv2 LR register was >> wrong, fortunately the current implementation does not use that bit. >> Fix it up (it's st

Re: [Xen-devel] [PATCH 27/57] ARM: new VGIC: Add data structure definitions

2018-03-06 Thread Andre Przywara
Hi, On 06/03/18 17:46, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:03, Andre Przywara wrote: >> Add a new header file for the new and improved GIC implementation. >> The big change is that we now have a struct vgic_irq per IRQ instead >> of spreading all t

Re: [Xen-devel] [PATCH 29/57] ARM: new VGIC: Implement virtual IRQ injection

2018-03-07 Thread Andre Przywara
Hi, On 07/03/18 11:02, Julien Grall wrote: > Hi Andre, > > Overall this patch looks good. Few comments below. > > On 03/05/2018 04:03 PM, Andre Przywara wrote: >> +/* >> + * Only valid injection if changing level for level-triggered IRQs or >> for a >> +

Re: [Xen-devel] [PATCH 31/57] ARM: new VGIC: Add IRQ sync/flush framework

2018-03-07 Thread Andre Przywara
Hi, On 07/03/18 11:47, Julien Grall wrote: > Hi Andre, > > On 03/05/2018 04:03 PM, Andre Przywara wrote: >> Implement the framework for syncing IRQs between our emulation and the >> list registers, which represent the guest's view of IRQs. >> This is do

Re: [Xen-devel] [PATCH 32/57] ARM: new VGIC: Add GICv2 world switch backend

2018-03-07 Thread Andre Przywara
Hi, On 07/03/18 12:10, Julien Grall wrote: > Hi Andre, > > On 03/05/2018 04:03 PM, Andre Przywara wrote: >> +void vgic_v2_fold_lr_state(struct vcpu *vcpu) >> +{ >> +    struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic; >> +    unsigned int used_lrs = vcpu-&g

Re: [Xen-devel] [PATCH 37/57] ARM: new VGIC: Add ENABLE registers handlers

2018-03-07 Thread Andre Przywara
Hi, On 07/03/18 17:01, Julien Grall wrote: > Hi Andre, > > On 03/05/2018 04:03 PM, Andre Przywara wrote: >> As the enable register handlers are shared between the v2 and v3 >> emulation, their implementation goes into vgic-mmio.c, to be easily >> referenced from the

Re: [Xen-devel] [PATCH 04/57] ARM: GICv3: simplify GICv3 redistributor stride handling

2018-03-08 Thread Andre Przywara
Hi, On 06/03/18 13:49, Julien Grall wrote: > > > On 05/03/18 17:08, Julien Grall wrote: >> On 05/03/18 16:03, Andre Przywara wrote: >>> Instead of hard coding the architected redistributor stride into the >>> code, lets use a clear #define to the two values fo

Re: [Xen-devel] [PATCH 40/57] ARM: new VGIC: Add PRIORITY registers handlers

2018-03-08 Thread Andre Przywara
Hi, On 08/03/18 15:48, Julien Grall wrote: > > > On 05/03/18 16:03, Andre Przywara wrote: >> The priority register handlers are shared between the v2 and v3 >> emulation, >> so their implementation goes into vgic-mmio.c, to be easily referenced >> from the v3

Re: [Xen-devel] [PATCH 21/57] ARM: GICv2: extend LR read/write functions to cover EOI and source

2018-03-08 Thread Andre Przywara
Hi, On 06/03/18 16:06, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:03, Andre Przywara wrote: >> So far our LR read/write functions do not handle the EOI bit and the >> source CPUID bits in an LR, because the current VGIC implementation does >> not use them

Re: [Xen-devel] [PATCH 42/57] ARM: new VGIC: Add TARGET registers handlers

2018-03-08 Thread Andre Przywara
Hi, On 08/03/18 16:18, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:04, Andre Przywara wrote: >> The target register handlers are v2 emulation specific, so their >> implementation lives entirely in vgic-mmio-v2.c. >> We copy the old VGIC behaviour of assigni

Re: [Xen-devel] Xen on POWER

2018-03-09 Thread Andre Przywara
Hi, On 09/03/18 10:38, awokd wrote: > On Fri, March 9, 2018 10:03 am, Andrew Cooper wrote: >> On 09/03/2018 09:37, awokd wrote: > >> >> Xen currently has x86 and ARM as supported architectures, so there is a >> reasonable split between common and arch-specific code.  As a start, you'd >> need to

[Xen-devel] [PATCH 06/17] ARM: VGIC: Move gic_remove_from_lr_pending() prototype

2018-03-09 Thread Andre Przywara
The prototype for gic_remove_from_lr_pending() is the last function in gic.h which references a VGIC data structure. Move it over to vgic.h, so that we can remove the inclusion of vgic.h from gic.h. We add it to asm/domain.h instead, where it is actually needed. Signed-off-by: Andre Przywara

[Xen-devel] [PATCH 00/17] ARM: vGIC: prepare for splitting the vGIC code

2018-03-09 Thread Andre Przywara
with those patches is available at the new-vgic/prep branch at: git://linux-arm.org/xen-ap.git http://www.linux-arm.org/git?p=xen-ap.git;a=shortlog;h=refs/heads/vgic-new/prep Cheers, Andre Andre Przywara (17): ARM: vGICv3: clarify on GUEST_GICV3_RDIST_REGIONS symbol ARM: GICv3: use hardware GICv3 red

[Xen-devel] [PATCH 07/17] ARM: VGIC: Adjust domain_max_vcpus() to be VGIC specific

2018-03-09 Thread Andre Przywara
structures. Move the actual functionality into vgic.c, and provide a shim in domain.h, to keep this VGIC internal. Signed-off-by: Andre Przywara --- Changelog: - rename helper function and wrap in domain.h xen/arch/arm/domain.c| 14 -- xen/arch/arm/vgic.c | 14

[Xen-devel] [PATCH 04/17] ARM: vGICv3: remove rdist_stride from VGIC structure

2018-03-09 Thread Andre Przywara
value. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- xen/arch/arm/gic-v3.c | 3 +-- xen/arch/arm/vgic-v3.c| 14 -- xen/include/asm-arm/domain.h | 1 - xen/include/asm-arm/vgic.h| 1 - xen/include/public/arch-arm.h | 1 - 5 files changed, 1 inse

[Xen-devel] [PATCH 08/17] ARM: VGIC: rename gic_event_needs_delivery()

2018-03-09 Thread Andre Przywara
gic_event_needs_delivery() is not named very intuitively, especially the gic_ prefix is somewhat misleading. Rename it to vgic_pending_irq(), which makes it clear that this relates to the virtual GIC and is about interrupts. Signed-off-by: Andre Przywara --- Changelog: - Add vcpu parameter

[Xen-devel] [PATCH 01/17] ARM: vGICv3: clarify on GUEST_GICV3_RDIST_REGIONS symbol

2018-03-09 Thread Andre Przywara
Normally there is only one GICv3 redistributor region, and we use that for DomU guests using a GICv3. Explain the background in a comment and why we need to keep the number of hardware regions for Dom0. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- xen/arch/arm/vgic-v3.c | 12

[Xen-devel] [PATCH 17/17] ARM: GICv2: fix GICH_V2_LR definitions

2018-03-09 Thread Andre Przywara
The bit definition for the CPUID mask in the GICv2 LR register was wrong, fortunately the current implementation does not use that bit. Fix it up (it's starting at bit 10, not bit 9) and clean up some nearby definitions on the way. This will be used by the new VGIC shortly. Signed-off-by:

[Xen-devel] [PATCH 02/17] ARM: GICv3: use hardware GICv3 redistributor values for Dom0

2018-03-09 Thread Andre Przywara
dware domain. This avoids the hardware GIC code to reference vGIC data structures. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- xen/arch/arm/gic-v3.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c

[Xen-devel] [PATCH 14/17] ARM: Implement vcpu_kick()

2018-03-09 Thread Andre Przywara
ity, using the already existing vcpu_kick() prototype (used in x86 only so far), to make this available to the rest of the Xen code. Signed-off-by: Andre Przywara --- - Rename to vcpu_kick(), to blend in with existing (x86) prototype xen/arch/arm/domain.c | 12 xen/arch/arm/vgi

[Xen-devel] [PATCH 05/17] ARM: VGIC: rename gic_inject() and gic_clear_lrs()

2018-03-09 Thread Andre Przywara
The two central functions to synchronise our emulated VGIC state with the GIC hardware (the LRs, really), are named somewhat confusingly. Rename them from gic_inject() to vgic_sync_to_lrs() and from gic_clear_lrs() to vgic_sync_from_lrs(), to make the code more readable. Signed-off-by: Andre

[Xen-devel] [PATCH 11/17] ARM: VGIC: reorder prototypes in vgic.h

2018-03-09 Thread Andre Przywara
Currently vgic.h both contains prototypes used by Xen arch code outside of the actual VGIC (for instance vgic_vcpu_inject_irq()), and prototypes for functions used by the VGIC internally. Group them to later allow an easy split with one #ifdef. Signed-off-by: Andre Przywara Reviewed-by: Julien

[Xen-devel] [PATCH 03/17] ARM: vGICv3: always use architected redist stride

2018-03-09 Thread Andre Przywara
27;s GICv3 emulation. Signed-off-by: Andre Przywara --- Changelog: - merge in GICV3_GICR_SIZE definition xen/arch/arm/gic-v3.c | 4 xen/arch/arm/vgic-v3.c| 14 ++ xen/include/asm-arm/gic_v3_defs.h | 5 + 3 files changed, 11 insertions(+), 12 deletions(

[Xen-devel] [PATCH 15/17] ARM: GICv2: introduce gicv2_poke_irq()

2018-03-09 Thread Andre Przywara
: Andre Przywara Reviewed-by: Julien Grall --- xen/arch/arm/gic-v2.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 2b271ba322..fa9afc2be8 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -235,6

[Xen-devel] [PATCH 12/17] ARM: VGIC: Introduce gic_get_nr_lrs()

2018-03-09 Thread Andre Przywara
So far the number of list registers (LRs) a GIC implements is only needed in the hardware facing side of the VGIC code (gic-vgic.c). The new VGIC will need this information in more and multiple places, so export a function that returns the number. Signed-off-by: Andre Przywara Reviewed-by

[Xen-devel] [PATCH 09/17] ARM: VGIC: change to level-IRQ compatible IRQ injection interface

2018-03-09 Thread Andre Przywara
prepares the callers to do the right thing later automatically. Signed-off-by: Andre Przywara --- Changelog: - keep function as returning void xen/arch/arm/domain.c | 4 ++-- xen/arch/arm/gic-v3-lpi.c | 2 +- xen/arch/arm/irq.c | 2 +- xen/arch/arm/time.c| 2 +-

[Xen-devel] [PATCH 13/17] ARM: GICv3: rename HYP interface definitions to use ICH_ prefix

2018-03-09 Thread Andre Przywara
heir usage in gic-v3.c and is needed to allow co-existence of the GICv2 and GICv3 definitions in the same file. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- xen/arch/arm/gic-v3.c | 48 +++--- xen/include/asm-ar

[Xen-devel] [PATCH 16/17] ARM: GICv3: poke_irq: make RWP optional

2018-03-09 Thread Andre Przywara
evaluates to 31. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- xen/arch/arm/gic-v3.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 8b41704cf1..09b49a07d5 100644 --- a/xen/arch/arm/gic-v3.c +++ b

[Xen-devel] [PATCH 10/17] ARM: VGIC: carve out struct vgic_cpu and struct vgic_dist

2018-03-09 Thread Andre Przywara
definition of these embedded structures into vgic.h, and just use the opaque type in the arch specific structures. This allows easy switching between different implementations later. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- xen/include/asm-arm/domain.h | 85

Re: [Xen-devel] [PATCH 51/57] ARM: new VGIC: Add preliminary stub implementation

2018-03-13 Thread Andre Przywara
Hi, On 09/03/18 18:18, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:04, Andre Przywara wrote: >> The ARM arch code requires an interrupt controller emulation to implement >> vgic_clear_pending_irqs(), although it is suspected that it is actually >> not necessary

Re: [Xen-devel] [PATCH 39/57] ARM: new VGIC: Add ACTIVE registers handlers

2018-03-13 Thread Andre Przywara
Hi, On 08/03/18 15:39, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:03, Andre Przywara wrote: >> The active register handlers are shared between the v2 and v3 emulation, >> so their implementation goes into vgic-mmio.c, to be easily referenced >> from the

Re: [Xen-devel] [PATCH 39/57] ARM: new VGIC: Add ACTIVE registers handlers

2018-03-13 Thread Andre Przywara
Hi, On 13/03/18 17:14, Julien Grall wrote: > Hi Andre, > > On 13/03/18 17:02, Andre Przywara wrote: >> On 08/03/18 15:39, Julien Grall wrote: >>> On 05/03/18 16:03, Andre Przywara wrote: >>>> +/* >>>> + * We don't actually support clearing th

Re: [Xen-devel] [PATCH 39/57] ARM: new VGIC: Add ACTIVE registers handlers

2018-03-14 Thread Andre Przywara
Hi, On 13/03/18 17:42, Julien Grall wrote: > Hi, > > On 13/03/18 17:34, Andre Przywara wrote: >> On 13/03/18 17:14, Julien Grall wrote: >>> On 13/03/18 17:02, Andre Przywara wrote: >>>> On 08/03/18 15:39, Julien Grall wrote: >>>>> On 05/03/18

Re: [Xen-devel] [PATCH 2/6] xen/arm: vgic: Override the group in lr everytime

2018-03-14 Thread Andre Przywara
On 09/03/18 17:35, julien.gr...@arm.com wrote: > From: Julien Grall > > At the moment, write_lr is assuming the caller will set correctly the > group. However the group should always be 0 when the guest is using > vGICv2 and 1 for vGICv3. As the caller should not care about the group, > override

Re: [Xen-devel] [PATCH 3/6] xen/arm: gic: Use bool instead of uint8_t for the hw_status in gic_lr

2018-03-14 Thread Andre Przywara
Hi, On 09/03/18 16:35, julien.gr...@arm.com wrote: > From: Julien Grall > > hw_status can only be 1 or 0. So convert to a bool. > > Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Cheers, Andre. > --- > xen/arch/arm/gic-v2.c | 9 + > xen/a

Re: [Xen-devel] [PATCH 4/6] xen/arm: gic: Split the field state in gic_lr in 2 fields active and pending

2018-03-14 Thread Andre Przywara
gt; @@ -209,7 +209,8 @@ struct gic_lr { > /* Virtual IRQ */ > uint32_t virq; > uint8_t priority; > - uint8_t state; > + bool active; > + bool pending; > bool hw_status; > }; > > diff --git a/xen/include/asm-arm/gic_v3_defs.h > b/xen/include/asm-arm

Re: [Xen-devel] [PATCH 5/6] xen/arm: GIC: Only set pirq in the LR when hw_status is set

2018-03-14 Thread Andre Przywara
ield (e.g eoi, source) that clashes with the PIRQ field. Makes some sense, yes. > Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Cheers, Andre. > --- > xen/arch/arm/gic-v2.c | 13 ++--- > xen/arch/arm/gic-v3.c | 10 +++--- > xen/include/asm-arm/

Re: [Xen-devel] [PATCH 6/6] ARM: GIC: extend LR read/write functions to cover EOI and source

2018-03-14 Thread Andre Przywara
Hi, On 09/03/18 16:35, julien.gr...@arm.com wrote: > From: Andre Przywara I think this is quite different from what I ever wrote, so please drop my authorship here. > So far our LR read/write functions do not handle the EOI bit and the > source CPUID bits in an LR, because the cur

[Xen-devel] [PATCH v2 05/45] xen/arm: gic: Use bool instead of uint8_t for the hw_status in gic_lr

2018-03-15 Thread Andre Przywara
From: Julien Grall hw_status can only be 1 or 0. So convert to a bool. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara --- Changes: - Remove == *LR_HW as it is pointless - Add Andre's reviewed-by xen/arch/arm/gic-v2.c | 9 + xen/arc

[Xen-devel] [PATCH v2 15/45] ARM: new VGIC: Add acccessor to new struct vgic_irq instance

2018-03-15 Thread Andre Przywara
interrupts and SPIs, but handles the ref-counting for LPIs. This is based on Linux commit 64a959d66e47, written by Christoffer Dall. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - reorder header file inclusion xen/arch/arm/vgic/vgic.c | 124

[Xen-devel] [PATCH v2 14/45] ARM: new VGIC: Add data structure definitions

2018-03-15 Thread Andre Przywara
to avoid touching all the users. This is based on Linux commit b18b57787f5e, written by Christoffer Dall. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - define CONFIG_EDGE to false instead of using enum - remove not needed forward declaration - remove unneeded macros - add emacs footer

[Xen-devel] [PATCH v2 06/45] xen/arm: gic: Split the field state in gic_lr in 2 fields active and pending

2018-03-15 Thread Andre Przywara
From: Julien Grall Mostly making the code nicer to read. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara --- Changes: - Use 1ULL - Remove pointless == *_STATE_* xen/arch/arm/gic-v2.c | 15 +++ xen/arch/arm/gic-v3.c

[Xen-devel] [PATCH v2 19/45] ARM: new VGIC: Add IRQ sync/flush framework

2018-03-15 Thread Andre Przywara
re is added in the following patches. This is based on Linux commit 0919e84c0fc1, written by Marc Zyngier. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - make functions void - do underflow setting directly (no v2/v3 indirection) - fix multiple SGIs injections (as the late Linux bugfix)

[Xen-devel] [PATCH v2 00/45] New VGIC(-v2) implementation

2018-03-15 Thread Andre Przywara
cesses - use interface for HCR bit changes - iterate over set CPU bits in SGI injection handler Andre Przywara (39): ARM: VGIC: rename gic_event_needs_delivery() ARM: Implement vcpu_kick() ARM: GIC: Allow tweaking the active and pending state of an IRQ ARM: GIC: Allow reading pending state

[Xen-devel] [PATCH v2 02/45] ARM: Implement vcpu_kick()

2018-03-15 Thread Andre Przywara
ity, using the already existing vcpu_kick() prototype (used in x86 only so far), to make this available to the rest of the Xen code. Also adjust the perfcounter name to reflect the new usage. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - use vcpu_kick() name from x86 and existing

[Xen-devel] [PATCH v2 03/45] xen/arm: gic: Fix indentation in gic_update_one_lr

2018-03-15 Thread Andre Przywara
From: Julien Grall Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - Add Andre's reviewed-by xen/arch/arm/gic-vgic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/gic-vgic.c b/xen/arc

[Xen-devel] [PATCH v2 08/45] ARM: GIC: extend LR read/write functions to cover EOI and source

2018-03-15 Thread Andre Przywara
on whether the vIRQ has a corresponding pIRQ. This allows the new VGIC to use this information. This is based on the original patch sent by Andre Przywara [1]. [1] https://lists.xenproject.org/archives/html/xen-devel/2018-03/msg00435.html Signed-off-by: Julien Grall Reviewed-by: Andre Przywara

[Xen-devel] [PATCH v2 22/45] ARM: new VGIC: Add MMIO handling framework

2018-03-15 Thread Andre Przywara
Marc Zyngier. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - adjust indentation - remove unneeded macros - use unsigned types - use new ilog2() implementation xen/arch/arm/vgic/vgic-mmio.c | 180 ++ xen/arch/arm/vgic/vgic-mmio.h

[Xen-devel] [PATCH v2 01/45] ARM: VGIC: rename gic_event_needs_delivery()

2018-03-15 Thread Andre Przywara
future. The current VGIC expect this to be the current VCPU, so add an assert to spot any regressions. Signed-off-by: Andre Przywara --- Changelog v1 .. v2: - rename to vgic_vcpu_pending_irq() - add VCPU parameter xen/arch/arm/gic

[Xen-devel] [PATCH v2 09/45] ARM: GIC: Allow tweaking the active and pending state of an IRQ

2018-03-15 Thread Andre Przywara
state of an associated hardware IRQ. This takes care of properly setting the _IRQ_INPROGRESS bit. For this it adds gicv2/3_peek_irq() helper functions, to read a bit in a bitmap spread over several MMIO registers. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - properly set _IRQ_INPROGRESS

[Xen-devel] [PATCH v2 12/45] ARM: evtchn: Handle level triggered IRQs correctly

2018-03-15 Thread Andre Przywara
evtchn_upcall_pending variable to make the interrupt line match its status, and call this function upon every hypervisor entry. Signed-off-by: Andre Przywara --- xen/arch/arm/domain.c | 7 +++ xen/arch/arm/traps.c| 1 + xen/include/asm-arm/event.h | 1 + 3 files changed, 9 insertions

[Xen-devel] [PATCH v2 07/45] xen/arm: GIC: Only set pirq in the LR when hw_status is set

2018-03-15 Thread Andre Przywara
Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara --- Changes: - Add Andre's reviewed-by xen/arch/arm/gic-v2.c | 13 ++--- xen/arch/arm/gic-v3.c | 10 +++--- xen/include/asm-arm/gic.h | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/xen/arch/ar

[Xen-devel] [PATCH v2 11/45] ARM: timer: Handle level triggered IRQs correctly

2018-03-15 Thread Andre Przywara
vGIC (and the LR). The VGIC in Xen so far only implemented edge triggered vIRQs, really, so we need to add new functionality to re-sample the interrupt state. Do this only when the new VGIC is in use. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - restrict to new VGIC - add TODO: comment

[Xen-devel] [PATCH v2 10/45] ARM: GIC: Allow reading pending state of a hardware IRQ

2018-03-15 Thread Andre Przywara
pending state of a particular interrupt. Due to hardware limitations this only works for private interrupts of the current CPU, so there is no CPU field in the prototype. This adds gicv2/3_peek_irq() helper functions, to read a bit in a bitmap spread over several MMIO registers. Signed-off-by: Andre

[Xen-devel] [PATCH v2 18/45] ARM: new VGIC: Add IRQ sorting

2018-03-15 Thread Andre Przywara
Adds the sorting function to cover the case where you have more IRQs to consider than you have LRs. We consider their priorities. This uses the new sort_list() implementation imported from Linux. This is based on Linux commit 8e4447457965, written by Christoffer Dall. Signed-off-by: Andre

[Xen-devel] [PATCH v2 31/45] ARM: new VGIC: Add SGIR register handler

2018-03-15 Thread Andre Przywara
Triggering an IPI via this register is v2 specific, so the implementation lives entirely in vgic-mmio-v2.c. This is based on Linux commit 55cc01fb9004, written by Andre Przywara. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - remove stray rebase artefact xen/arch/arm/vgic/vgic-mmio

[Xen-devel] [PATCH v2 33/45] ARM: new VGIC: Handle hardware mapped IRQs

2018-03-15 Thread Andre Przywara
physical world. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- Changelog v1 ... v2: - Add Reviewed-by: xen/arch/arm/vgic/vgic.c | 71 1 file changed, 71 insertions(+) diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c index

[Xen-devel] [PATCH v2 16/45] ARM: new VGIC: Implement virtual IRQ injection

2018-03-15 Thread Andre Przywara
patch. This is based on Linux commit 81eeb95ddbab, written by Christoffer Dall. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - rework validate_injection() - add comments - make vgic_inject_irq a void function - fix comment xen/arch/arm/vgic/vgic.c

[Xen-devel] [PATCH v2 04/45] xen/arm: vgic: Override the group in lr everytime

2018-03-15 Thread Andre Przywara
like update_lr for the group. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara --- Changes: - Add Andre's reviewed-by xen/arch/arm/gic-v2.c | 4 +--- xen/arch/arm/gic-v3.c | 11 --- xen/include/asm-arm/gic.h | 1 - 3 files chang

[Xen-devel] [PATCH v2 13/45] ARM: vPL011: Use the VGIC's level triggered IRQs handling if available

2018-03-15 Thread Andre Przywara
The emulated ARM SBSA UART is using level triggered IRQ semantics, however the current VGIC can only handle edge triggered IRQs, really. Disable the existing workaround for this problem in case we have the new VGIC in place, which can properly handle level triggered IRQs. Signed-off-by: Andre

[Xen-devel] [PATCH v2 17/45] Add list_sort() routine from Linux

2018-03-15 Thread Andre Przywara
This pulls in Linux' list_sort.c, which is a merge sort implementation for linked lists. Apart from adding a full featured license header and adjusting the #include file, nothing has been changed in this code. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - split out to just co

[Xen-devel] [PATCH v2 21/45] ARM: new VGIC: Implement vgic_vcpu_pending_irq

2018-03-15 Thread Andre Przywara
Tell Xen whether a particular VCPU has an IRQ that needs handling in the guest. This is used to decide whether a VCPU is runnable or if a hypercall should be preempted to let the guest handle the IRQ. This is based on Linux commit 90eee56c5f90, written by Eric Auger. Signed-off-by: Andre

[Xen-devel] [PATCH v2 30/45] ARM: new VGIC: Add TARGET registers handlers

2018-03-15 Thread Andre Przywara
a hardware mapped vIRQ on the way. This is based on Linux commit 2c234d6f1826, written by Andre Przywara. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - directly update affinity (avoid vgic_sync_hardware_irq() and lock) xen/arch/arm/vgic/vgic-mmio-v2.c | 59

[Xen-devel] [PATCH v2 40/45] ARM: new VGIC: vgic-init: register VGIC

2018-03-15 Thread Andre Przywara
This patch implements the function which is called by Xen when it wants to register the virtual GIC. This also implements vgic_max_vcpus() for the new VGIC, which reports back the maximum number of VCPUs a certain GIC model supports. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic/vgic

[Xen-devel] [PATCH v2 34/45] ARM: new VGIC: Add event channel IRQ handling

2018-03-15 Thread Andre Przywara
The Xen core/arch code relies on two abstracted functions to inject an event channel IRQ and to query its pending state. Implement those to query the state of the new VGIC implementation. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Changelog v1 ... v2: - Add Acked-by: xen/arch

[Xen-devel] [PATCH v2 41/45] ARM: new VGIC: Add vgic_v2_enable

2018-03-15 Thread Andre Przywara
Enable the VGIC operation by properly initialising the registers in the hypervisor GIC interface. This is based on Linux commit f7b6985cc3d0, written by Eric Auger. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - move patch from later part in the series xen/arch/arm/vgic/vgic-v2.c

[Xen-devel] [PATCH v2 28/45] ARM: new VGIC: Add PRIORITY registers handlers

2018-03-15 Thread Andre Przywara
The priority register handlers are shared between the v2 and v3 emulation, so their implementation goes into vgic-mmio.c, to be easily referenced from the v3 emulation as well later. This is based on Linux commit 055658bf48fc, written by Andre Przywara. Signed-off-by: Andre Przywara

[Xen-devel] [PATCH v2 20/45] ARM: new VGIC: Add GICv2 world switch backend

2018-03-15 Thread Andre Przywara
setup the host GIC addresses. This is based on Linux commit 140b086dd197, written by Marc Zyngier. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - remove v2 specific underflow function (now generic) - re-add Linux code to properly handle acked level IRQs xen/arch/arm/vgic/vgic-v2.c

[Xen-devel] [PATCH v2 42/45] ARM: new VGIC: vgic-init: implement vgic_init

2018-03-15 Thread Andre Przywara
initialize the VGIC. Their prototypes are already in existing header files. This is based on Linux commit ad275b8bb1e6, written by Eric Auger. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - remove stray kvm_ prefix in comment - use unsigned int - ROUNDUP number of SPIs - fix

[Xen-devel] [PATCH v2 24/45] ARM: new VGIC: Add CTLR, TYPER and IIDR handlers

2018-03-15 Thread Andre Przywara
revision). When the guest enables the distributor, we kick all VCPUs to get potentially pending interrupts serviced. This is based on Linux commit 2b0cda878965, written by Marc Zyngier. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - use new IIDR values (KVM product ID, Xen revision) - add

[Xen-devel] [PATCH v2 23/45] ARM: new VGIC: Add GICv2 MMIO handling framework

2018-03-15 Thread Andre Przywara
on Linux commit fb848db39661, written by Andre Przywara. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- Changelog v1 ... v2: - Add Reviewed-by: xen/arch/arm/vgic/vgic-mmio-v2.c | 83 xen/arch/arm/vgic/vgic-mmio.c| 25 xen

[Xen-devel] [PATCH v2 26/45] ARM: new VGIC: Add PENDING registers handlers

2018-03-15 Thread Andre Przywara
combine it with the device's level to get the actual pending state. Hardware mapped IRQs need some special handling, as their hardware state has to be coordinated with the virtual pending bit to avoid hanging or masked interrupts. This is based on Linux commit 96b298000db4, written by Andre Prz

[Xen-devel] [PATCH v2 25/45] ARM: new VGIC: Add ENABLE registers handlers

2018-03-15 Thread Andre Przywara
. Because the existing locking order between vgic_irq->irq_lock and irq_desc->lock dictates so, we drop the irq_lock and retake them in the proper order. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - ASSERT on h/w IRQ and vIRQ staying in sync xen/arch/arm/vgic/vgic-mmio-v2.c

[Xen-devel] [PATCH v2 27/45] ARM: new VGIC: Add ACTIVE registers handlers

2018-03-15 Thread Andre Przywara
, so chances are we are tasked to clear bits that are already zero. Add a simple check to avoid pointless warnings in this case. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - print a line for every failing IRQ xen/arch/arm/vgic/vgic-mmio-v2.c | 4 +- xen/arch/arm/vgic/vgic-mmio.c

[Xen-devel] [PATCH v2 45/45] ARM: VGIC: wire new VGIC(-v2) files into Xen build system

2018-03-15 Thread Andre Przywara
n the moment this is restricted to a vGIC-v2. To make the build system happy, we provide a temporary dummy implementation of vgic_v3_setup_hw() to allow building for now. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - add Kconfig help text - use separate Makefile in vgic/ directory -

[Xen-devel] [PATCH v2 35/45] ARM: new VGIC: Handle virtual IRQ allocation/reservation

2018-03-15 Thread Andre Przywara
can't easily reuse the existing implementation. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Changelog v1 ... v2: - Add Acked-by: xen/arch/arm/vgic/vgic.c | 44 1 file changed, 44 insertions(+) diff --git a/xen/arch/arm/vgic/vgic.c

[Xen-devel] [PATCH v2 29/45] ARM: new VGIC: Add CONFIG registers handlers

2018-03-15 Thread Andre Przywara
The config register handlers are shared between the v2 and v3 emulation, so their implementation goes into vgic-mmio.c, to be easily referenced from the v3 emulation as well later. This is based on Linux commit 79717e4ac09c, written by Andre Przywara. Signed-off-by: Andre Przywara Reviewed-by

[Xen-devel] [PATCH v2 36/45] ARM: new VGIC: Dump virtual IRQ info

2018-03-15 Thread Andre Przywara
When we dump guest state on the Xen console, we also print the state of IRQs that are on a VCPU. Add the code to dump the state of an IRQ handled by the new VGIC. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Changelog v1 ... v2: - Add Acked-by: xen/arch/arm/vgic/vgic.c | 25

[Xen-devel] [PATCH v2 39/45] ARM: new VGIC: Add preliminary stub implementation

2018-03-15 Thread Andre Przywara
The ARM arch code requires an interrupt controller emulation to implement vgic_clear_pending_irqs(), although it is suspected that it is actually not necessary. Go with a stub for now to make the linker happy. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic/vgic.c | 8 1 file

[Xen-devel] [PATCH v2 37/45] ARM: new VGIC: Provide system register emulation stub

2018-03-15 Thread Andre Przywara
The Xen arch code traps system registers writes from the guest and will relay anything GIC related to the VGIC. Since this affects only GICv3 (which we don't yet emulate), provide a stub implementation of vgic_emulate() for now. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Chan

[Xen-devel] [PATCH v2 44/45] ARM: new VGIC: Allocate two pages for struct vcpu

2018-03-15 Thread Andre Przywara
there is no real technical reason this struct has to fit in one page, so lifting the limit to two pages seems like the most pragmatic solution. Restrict this to compiling with the new VGIC and for ARM64 only. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - confine change to new VGIC and

[Xen-devel] [PATCH v2 32/45] ARM: new VGIC: Add SGIPENDR register handlers

2018-03-15 Thread Andre Przywara
As this register is v2 specific, its implementation lives entirely in vgic-mmio-v2.c. This register allows setting the source mask of an IPI. This is based on Linux commit ed40213ef9b0, written by Andre Przywara. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- Changelog v1 ... v2

[Xen-devel] [PATCH v2 38/45] ARM: new VGIC: Implement arch_move_irqs()

2018-03-15 Thread Andre Przywara
When a VCPU moves to another CPU, we need to adjust the target affinity of any hardware mapped vIRQs, to observe our "physical-follows-virtual" policy. Implement arch_move_irqs() to adjust the physical affinity of all hardware mapped vIRQs targetting this VCPU. Signed-off-by: Andr

[Xen-devel] [PATCH v2 43/45] ARM: new VGIC: vgic-init: implement map_resources

2018-03-15 Thread Andre Przywara
-by: Andre Przywara --- Changelog v1 ... v2: - whitespace fixes xen/arch/arm/vgic/vgic-v2.c | 66 + xen/arch/arm/vgic/vgic.h| 1 + 2 files changed, 67 insertions(+) diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c index

Re: [Xen-devel] [PATCH v2 45/45] ARM: VGIC: wire new VGIC(-v2) files into Xen build system

2018-03-16 Thread Andre Przywara
Hi, On 16/03/18 10:48, Jan Beulich wrote: On 15.03.18 at 21:30, wrote: >> --- a/xen/common/Makefile >> +++ b/xen/common/Makefile >> @@ -19,6 +19,7 @@ obj-y += keyhandler.o >> obj-$(CONFIG_KEXEC) += kexec.o >> obj-$(CONFIG_KEXEC) += kimage.o >> obj-y += lib.o >> +obj-y += list_sort.o > >

Re: [Xen-devel] [PATCH v2 45/45] ARM: VGIC: wire new VGIC(-v2) files into Xen build system

2018-03-16 Thread Andre Przywara
Hi, On 16/03/18 11:32, Jan Beulich wrote: On 16.03.18 at 12:10, wrote: >> On 16/03/18 10:48, Jan Beulich wrote: >> On 15.03.18 at 21:30, wrote: --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -19,6 +19,7 @@ obj-y += keyhandler.o obj-$(CONFIG_KEXEC) += kexec.o

Re: [Xen-devel] [PATCH v2 09/45] ARM: GIC: Allow tweaking the active and pending state of an IRQ

2018-03-16 Thread Andre Przywara
Hi, On 15/03/18 20:30, Andre Przywara wrote: > When playing around with hardware mapped, level triggered virtual IRQs, > there is the need to explicitly set the active or pending state of an > interrupt at some point. > To prepare the GIC for that, we introduce a set_active_s

Re: [Xen-devel] [PATCH v2 06/45] xen/arm: gic: Split the field state in gic_lr in 2 fields active and pending

2018-03-19 Thread Andre Przywara
Hi, On 16/03/18 22:52, Stefano Stabellini wrote: > On Fri, 16 Mar 2018, Julien Grall wrote: >> On 16/03/2018 21:34, Stefano Stabellini wrote: >>> On Thu, 15 Mar 2018, Andre Przywara wrote: >>>> From: Julien Grall >>>> diff --git a/xen/include/asm-arm/gi

Re: [Xen-devel] [PATCH v2 31/45] ARM: new VGIC: Add SGIR register handler

2018-03-19 Thread Andre Przywara
Hi, On 19/03/18 09:47, Julien Grall wrote: > Hi Andre, > > On 03/15/2018 08:30 PM, Andre Przywara wrote: >> Triggering an IPI via this register is v2 specific, so the >> implementation lives entirely in vgic-mmio-v2.c. >> >> This is based on Linux commit 55cc01

Re: [Xen-devel] [PATCH v2 19/45] ARM: new VGIC: Add IRQ sync/flush framework

2018-03-19 Thread Andre Przywara
Hi, On 19/03/18 14:17, Julien Grall wrote: > Hi, > > On 03/15/2018 08:30 PM, Andre Przywara wrote: >> Implement the framework for syncing IRQs between our emulation and the >> list registers, which represent the guest's view of IRQs. >> This is done in vgic_sync

Re: [Xen-devel] [PATCH 28/57] ARM: new VGIC: Add acccessor to new struct vgic_irq instance

2018-03-19 Thread Andre Przywara
Hi, On 06/03/18 18:13, Julien Grall wrote: > Hi Andre, > > On 05/03/18 16:03, Andre Przywara wrote: >> The new VGIC implementation centers around a struct vgic_irq instance >> per virtual IRQ. >> Provide a function to retrieve the right instance for a given IRQ >&g

Re: [Xen-devel] [PATCH v2 09/45] ARM: GIC: Allow tweaking the active and pending state of an IRQ

2018-03-19 Thread Andre Przywara
Hi, On 19/03/18 09:30, Julien Grall wrote: > > > On 03/16/2018 04:05 PM, Andre Przywara wrote: >> Hi, > > Hi Andre, > >> On 15/03/18 20:30, Andre Przywara wrote: >>> +    } >>> +} >>> + >>> +static void gicv2_set_pending_sta

Re: [Xen-devel] [PATCH 28/57] ARM: new VGIC: Add acccessor to new struct vgic_irq instance

2018-03-20 Thread Andre Przywara
Hi, On 19/03/18 21:53, Julien Grall wrote: > > > On 03/19/2018 05:32 PM, Andre Przywara wrote: >> Hi, > > Hi, > >> On 06/03/18 18:13, Julien Grall wrote: >>> Hi Andre, >>> >>> On 05/03/18 16:03, Andre Przywara wrote: >>>>

Re: [Xen-devel] [PATCH v2 00/45] New VGIC(-v2) implementation

2018-03-20 Thread Andre Przywara
Hi, On 20/03/18 08:30, Julien Grall wrote: > Hi, > > On 03/15/2018 08:30 PM, Andre Przywara wrote: >> tl;dr: Coarse changelog below, individual patches have changelogs as >> well. git branch: >> http://www.linux-arm.org/git?p=xen-ap.git;a=shortlog;h=refs/heads/vg

<    1   2   3   4   5   >