xen/arm: vgic: Support 32-bit access for 64-bit register
v3 cover xen/arm: vgic: Support 32-bit access for 64-bit register
Hi all,
This series aims to fixc the 32-bit access on 64-bit register. Some guest OS such as FreeBSD and Linux (only in ITS) use 32-bit access and will crash at boot time.
I took the opportunity to go further and optimize the way Xen is storing registers such as GICD_IPRIORITYR, GICD_ITARGETSR and GICD_IROUTER.
For all changes see in each patch.
A branch has been pushed based on the latest staging:
git://xenbits.xen.org/people/julieng/xen-unstable.git branch gicv3-32bit-v2
Julien Grall (9):
xen/arm: io: remove mmio_check_t typedef
xen/arm: io: Extend write/read handler to pass the register in
parameter
xen/arm: io: Support sign-extension for every read access xen/arm: vgic: ctlr stores a 32-bit hardware register so use uint32_t xen/arm: vgic: Optimize the way to store GICD_IPRIORITYR in the rank xen/arm: vgic: Introduce a new field to store the rank index and use
it
xen/arm: vgic: Optimize the way to store the target vCPU in the rank xen/arm: vgic: Introduce helpers to extract/update/clear/set vGIC
register ...
xen/arm: vgic-v3: Support 32-bit access for 64-bit registers
xen/arch/arm/io.c | 34 ++++- xen/arch/arm/vgic-v2.c | 308 +++++++++++++++++++------------------ xen/arch/arm/vgic-v3.c | 353 +++++++++++++++++++++++-------------------- xen/arch/arm/vgic.c | 70 +++++++-- xen/arch/arm/vuart.c | 20 ++- xen/include/asm-arm/domain.h | 2 +- xen/include/asm-arm/mmio.h | 7 +- xen/include/asm-arm/vgic.h | 151 ++++++++++++++---- 8 files changed, 582 insertions(+), 363 deletions(-)
Signature · 1 line
2.1.4
PATCH v3 1/9 xen/arm: io: remove mmio_check_t typedef
This typedef is a left-over of the previous MMIO emulation implementation.
---
Changes in v2:
- Add Ian's Acked-by
Changes in v1:
- Patch added
--- xen/include/asm-arm/mmio.h | 1 - 1 file changed, 1 deletion(-)
xen/include/asm-arm/mmio.h +0 -1
@@ -34,7 +34,6 @@ typedef structtypedef int (*mmio_read_t )(struct vcpu *v,mmio_info_t *info,void *priv);typedef int (*mmio_write_t )(struct vcpu *v,mmio_info_t *info,void *priv); -typedef int (*mmio_check_t )(struct vcpu *v,paddr_t addr);struct mmio_handler_ops {mmio_read_t read;
Signature · 1 line
2.1.4
PATCH v3 2/9 xen/arm: io: Extend write/read handler to pass the register in parameter
In reply to Julien GrallRather than letting each handler to retrieve the register used by the I/O access, add a new parameter to pass the register in parameter.
This will help to implement generic register manipulation on I/O access such as sign-extension and endianess.
Read handlers need to modify the value of the register, so a pointer to it is given in argument. Write handlers shouldn't modify the register, therefore only a plain value is given.
---
Changes in v2:
- Rebase on top of "xen/arm: io: Extend write/read handler to pass private data"
- Add Ian's acked-by
Changes in v1:
- Patch added
[1] http://lists.xen.org/archives/html/xen-devel/2015-09/msg03753.html
--- xen/arch/arm/io.c | 7 +++- xen/arch/arm/vgic-v2.c | 44 +++++++++----------- xen/arch/arm/vgic-v3.c | 101 ++++++++++++++++++++------------------------- xen/arch/arm/vuart.c | 20 ++++----- xen/include/asm-arm/mmio.h | 6 ++- 5 files changed, 83 insertions(+), 95 deletions(-)
xen/arch/arm/io.c +5 -2
@@ -29,6 +29,9 @@ int handle_mmio(mmio_info_t *info)int i;const struct mmio_handler *handler =NULL ;const struct vmmio *vmmio = &v->domain->arch.vmmio; +struct hsr_dabt dabt = info->dabt; +struct cpu_user_regs *regs =guest_cpu_user_regs (); +register_t *r =select_user_reg (regs, dabt.reg);for ( i =0 ; i < vmmio->num_entries; i++ ) {
@@ -43,9 +46,9 @@ int handle_mmio(mmio_info_t *info)return 0 ;if ( info->dabt.write ) -return handler->ops->write (v, info, handler->priv); +return handler->ops->write (v, info, *r, handler->priv);else -return handler->ops->read (v, info, handler->priv); +return handler->ops->read (v, info, r, handler->priv); } void register_mmio_handler(struct domain *d,
xen/arch/arm/vgic-v2.c +20 -24
157 lines not on this page · raw message
xen/arch/arm/vgic-v3.c +45 -56
330 lines not on this page · raw message
xen/arch/arm/vuart.c +9 -11
@@ -45,8 +45,10 @@#define domain_has_vuart (d) ((d)->arch.vuart.info != NULL) -static int vuart_mmio_read (struct vcpu *v,mmio_info_t *info,void *priv); -static int vuart_mmio_write (struct vcpu *v,mmio_info_t *info,void *priv); +static int vuart_mmio_read (struct vcpu *v,mmio_info_t *info, +register_t *r,void *priv); +static int vuart_mmio_write (struct vcpu *v,mmio_info_t *info, +register_t r,void *priv);static const struct mmio_handler_ops vuart_mmio_handler = { .read = vuart_mmio_read,
@@ -106,12 +108,10 @@ static void vuart_print_char(struct vcpu *v, char c)spin_unlock (&uart->lock); } -static int vuart_mmio_read (struct vcpu *v,mmio_info_t *info,void *priv) +static int vuart_mmio_read (struct vcpu *v,mmio_info_t *info, +register_t *r,void *priv) {struct domain *d = v->domain; -struct hsr_dabt dabt = info->dabt; -struct cpu_user_regs *regs =guest_cpu_user_regs (); -register_t *r =select_user_reg (regs, dabt.reg);paddr_t offset = info->gpa - d->arch.vuart.info->base_addr;perfc_incr (vuart_reads);
@@ -126,19 +126,17 @@ static int vuart_mmio_read(struct vcpu *v, mmio_info_t *info, void *priv)return 1 ; } -static int vuart_mmio_write (struct vcpu *v,mmio_info_t *info,void *priv) +static int vuart_mmio_write (struct vcpu *v,mmio_info_t *info, +register_t r,void *priv) {struct domain *d = v->domain; -struct hsr_dabt dabt = info->dabt; -struct cpu_user_regs *regs =guest_cpu_user_regs (); -register_t *r =select_user_reg (regs, dabt.reg);paddr_t offset = info->gpa - d->arch.vuart.info->base_addr;perfc_incr (vuart_writes);if ( offset == d->arch.vuart.info->data_off )/* ignore any status bits */ -vuart_print_char (v, *r &0xFF ); +vuart_print_char (v, r &0xFF );return 1 ; }
xen/include/asm-arm/mmio.h +4 -2
@@ -32,8 +32,10 @@ typedef structpaddr_t gpa; } mmio_info_t; -typedef int (*mmio_read_t )(struct vcpu *v,mmio_info_t *info,void *priv); -typedef int (*mmio_write_t )(struct vcpu *v,mmio_info_t *info,void *priv); +typedef int (*mmio_read_t )(struct vcpu *v,mmio_info_t *info, +register_t *r,void *priv); +typedef int (*mmio_write_t )(struct vcpu *v,mmio_info_t *info, +register_t r,void *priv);struct mmio_handler_ops {mmio_read_t read;
Signature · 1 line
2.1.4
PATCH v3 3/9 xen/arm: io: Support sign-extension for every read access
In reply to Julien GrallThe guest may try to load data from the emulated MMIO region using instructions with Sign-Extension (i.e ldrs*). Any use of one those, will set the SSE bit (Syndrome Sign Extend) in the ISS (see B3-1433 in DDI 0406C.b).
Note that the bit can only be set for access size smaller than the register size (i.e byte/half-word for aarch32, byte/half-word/word for aarch32). So we don't have to worry about undefined C behavior.
Until now, the support of sign-extension was limited for byte access in vGIC emulation. Although there is no reason to not have it generically.
So move the support just after we get the data from the MMIO emulation.
---
Changes in v3:
- Update a comment I forgot to address it in v2
- Add Ian's acked-by
Changes in v2:
- Rebase on top of "xen/arm: io: Extend write/read handler to pass private data" [1]
- Fix typeos
- Expand the commit message to explain the access size supported
- Add "io: " in the commit title
Changes in v1:
- Patch added
[1] http://lists.xen.org/archives/html/xen-devel/2015-09/msg03753.html
--- xen/arch/arm/io.c | 29 ++++++++++++++++++++++++++++- xen/arch/arm/vgic-v2.c | 10 +++++----- xen/arch/arm/vgic-v3.c | 4 ++-- xen/include/asm-arm/vgic.h | 8 +++----- 4 files changed, 38 insertions(+), 13 deletions(-)
xen/arch/arm/io.c +28 -1
@@ -23,6 +23,33 @@#include <asm/current.h> #include <asm/mmio.h> +static int handle_read (const struct mmio_handler *handler,struct vcpu *v, +mmio_info_t *info,register_t *r) +{ +uint8_t size = (1 << info->dabt.size) *8 ; + +if ( !handler->ops->read (v, info, r, handler->priv) ) +return 0 ; + +/* +* Sign extend if required. +* Note that we expect the read handler to have zeroed the bits +* outside the requested access size. +*/ +if ( info->dabt.sign && (*r & (1UL << (size -1 )) )) + { +/* +* We are relying on register_t using the same as +* an unsigned long in order to keep the 32-bit assembly +* code smaller. +*/ +BUILD_BUG_ON (sizeof (register_t) !=sizeof (unsigned long )); + *r |= (~0UL ) << size; + } + +return 1 ; +} +int handle_mmio (mmio_info_t *info) {struct vcpu *v = current;
@@ -48,7 +75,7 @@ int handle_mmio(mmio_info_t *info)if ( info->dabt.write )return handler->ops->write (v, info, *r, handler->priv);else -return handler->ops->read (v, info, r, handler->priv); +return handle_read (handler, v, info, r); } void register_mmio_handler(struct domain *d,
xen/arch/arm/vgic-v2.c +5 -5
@@ -129,7 +129,7 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info, *r = rank->v2.itargets[REG_RANK_INDEX (8 , gicd_reg -GICD_ITARGETSR ,DABT_WORD )];if ( dabt.size ==DABT_BYTE ) - *r =vgic_byte_read (*r, dabt.sign, gicd_reg); + *r =vgic_byte_read (*r, gicd_reg);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -142,7 +142,7 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info, *r = rank->ipriority[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR ,DABT_WORD )];if ( dabt.size ==DABT_BYTE ) - *r =vgic_byte_read (*r, dabt.sign, gicd_reg); + *r =vgic_byte_read (*r, gicd_reg);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -377,7 +377,7 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info, new_target = i %8 ; old_target_mask =vgic_byte_read (rank->v2.itargets[REG_RANK_INDEX (8 , - gicd_reg -GICD_ITARGETSR ,DABT_WORD )],0 , i/8 ); + gicd_reg -GICD_ITARGETSR ,DABT_WORD )], i/8 ); old_target =find_first_bit (&old_target_mask,8 );if ( new_target != old_target )
@@ -503,7 +503,7 @@ static struct vcpu *vgic_v2_get_target_vcpu(struct vcpu *v, unsigned int irq)ASSERT (spin_is_locked (&rank->lock)); target =vgic_byte_read (rank->v2.itargets[REG_RANK_INDEX (8 , - irq,DABT_WORD )],0 , irq &0x3 ); + irq,DABT_WORD )], irq &0x3 );/* 1-N SPI should be delivered as pending to all the vcpus in the * mask, but here we just return the first vcpu for simplicity and
@@ -521,7 +521,7 @@ static int vgic_v2_get_irq_priority(struct vcpu *v, unsigned int irq)ASSERT (spin_is_locked (&rank->lock)); priority =vgic_byte_read (rank->ipriority[REG_RANK_INDEX (8 , - irq,DABT_WORD )],0 , irq &0x3 ); + irq,DABT_WORD )], irq &0x3 );return priority; }
xen/arch/arm/vgic-v3.c +2 -2
@@ -336,7 +336,7 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v, *r = rank->ipriority[REG_RANK_INDEX (8 , reg -GICD_IPRIORITYR ,DABT_WORD )];if ( dabt.size ==DABT_BYTE ) - *r =vgic_byte_read (*r, dabt.sign, reg); + *r =vgic_byte_read (*r, reg);vgic_unlock_rank (v, rank, flags);return 1 ; case GICD_ICFGR ... GICD_ICFGRN:
@@ -1042,7 +1042,7 @@ static int vgic_v3_get_irq_priority(struct vcpu *v, unsigned int irq)ASSERT (spin_is_locked (&rank->lock)); priority =vgic_byte_read (rank->ipriority[REG_RANK_INDEX (8 , - irq,DABT_WORD )],0 , irq &0x3 ); + irq,DABT_WORD )], irq &0x3 );return priority; }
xen/include/asm-arm/vgic.h +3 -5
@@ -158,15 +158,13 @@ static inline int REG_RANK_NR(int b, uint32_t n) } } -static inline uint32_t vgic_byte_read (uint32_t val,int sign,int offset) +static inline uint32_t vgic_byte_read (uint32_t val,int offset) {int byte = offset &0x3 ; val = val >> (8 *byte); -if ( sign && (val &0x80 ) ) - val |=0xffffff00 ; -else - val &=0x000000ff ; + val &=0x000000ff ; +return val; }
Signature · 1 line
2.1.4
PATCH v3 4/9 xen/arm: vgic: ctlr stores a 32-bit hardware register so use uint32_t
In reply to Julien Grall---
Changes in v2:
- Add Ian's acked-by
Changes in v1:
- Patch added
--- xen/include/asm-arm/domain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/asm-arm/domain.h +1 -1
@@ -91,7 +91,7 @@ struct arch_domain* rank order. */ spinlock_t lock; -int ctlr; +uint32_t ctlr;int nr_spis;/* Number of SPIs */ unsigned long *allocated_irqs;/* bitmap of IRQs allocated */ struct vgic_irq_rank *shared_irqs;
Signature · 1 line
2.1.4
PATCH v3 5/9 xen/arm: vgic: Optimize the way to store GICD_IPRIORITYR in the rank
In reply to Julien GrallXen is currently directly storing the value of GICD_IPRIORITYR register in the rank. This makes emulation of the register access very simple but makes the code to get the priority for a given vIRQ more complex.
While the priority of an vIRQ is retrieved every time an vIRQ is injected to the guest, the access to register occurs less often.
Each GICD_IPRIORITYR register stores 4 priorities associated for 4 vIRQs (see 4.3.11 in IHI 0048B). As Xen is using little endian, we can use an union to access directly a register or a priority for a given IRQ.
Note that the field "ipriority" has been renamed to "ipriorityr" to match the name of the register in the GIC spec.
Finally, the implementation of the callback get_irq_priority is exactly the same for both vGIC drivers. Consolidate the implementation in the common vGIC code and drop the callback.
---
The real reason is I'd like to drop vgic_byte_* helpers in favors of more generic access helper. Although it would make the code to retrieve the priority more complex. So reworking the way to get the priority was the best solution.
Changes in v3:
- Add Ian's acked-by
Changes in v2:
- Use an union to get the best of the emulation and getting the priority quickly
- Remove the callback get_irq_priority
- Update commit message
Changes in v1:
- Patch added
--- xen/arch/arm/vgic-v2.c | 23 +++++------------------ xen/arch/arm/vgic-v3.c | 23 +++++------------------ xen/arch/arm/vgic.c | 18 ++++++++++++++---- xen/include/asm-arm/vgic.h | 17 ++++++++++++++--- 4 files changed, 38 insertions(+), 43 deletions(-)
xen/arch/arm/vgic-v2.c +5 -18
@@ -139,8 +139,8 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info,if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->ipriority[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR , -DABT_WORD )]; + *r = rank->ipriorityr[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR , +DABT_WORD )];if ( dabt.size ==DABT_BYTE ) *r =vgic_byte_read (*r, gicd_reg);vgic_unlock_rank (v, rank, flags);
@@ -405,10 +405,10 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags);if ( dabt.size ==DABT_WORD ) - rank->ipriority[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR , -DABT_WORD )] = r; + rank->ipriorityr[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR , +DABT_WORD )] = r;else -vgic_byte_write (&rank->ipriority[REG_RANK_INDEX (8 , +vgic_byte_write (&rank->ipriorityr[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR ,DABT_WORD )], r, gicd_reg);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -514,18 +514,6 @@ static struct vcpu *vgic_v2_get_target_vcpu(struct vcpu *v, unsigned int irq)return v_target; } -static int vgic_v2_get_irq_priority (struct vcpu *v,unsigned int irq) -{ -int priority; -struct vgic_irq_rank *rank =vgic_rank_irq (v, irq); - -ASSERT (spin_is_locked (&rank->lock)); - priority =vgic_byte_read (rank->ipriority[REG_RANK_INDEX (8 , - irq,DABT_WORD )], irq &0x3 ); - -return priority; -} -static int vgic_v2_vcpu_init (struct vcpu *v) {int i;
@@ -597,7 +585,6 @@ static int vgic_v2_domain_init(struct domain *d)static const struct vgic_ops vgic_v2_ops = { .vcpu_init = vgic_v2_vcpu_init, .domain_init = vgic_v2_domain_init, - .get_irq_priority = vgic_v2_get_irq_priority, .get_target_vcpu = vgic_v2_get_target_vcpu, .max_vcpus =8 , };
xen/arch/arm/vgic-v3.c +5 -18
@@ -333,8 +333,8 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->ipriority[REG_RANK_INDEX (8 , reg -GICD_IPRIORITYR , -DABT_WORD )]; + *r = rank->ipriorityr[REG_RANK_INDEX (8 , reg -GICD_IPRIORITYR , +DABT_WORD )];if ( dabt.size ==DABT_BYTE ) *r =vgic_byte_read (*r, reg);vgic_unlock_rank (v, rank, flags);
@@ -435,10 +435,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags);if ( dabt.size ==DABT_WORD ) - rank->ipriority[REG_RANK_INDEX (8 , reg -GICD_IPRIORITYR , -DABT_WORD )] = r; + rank->ipriorityr[REG_RANK_INDEX (8 , reg -GICD_IPRIORITYR , +DABT_WORD )] = r;else -vgic_byte_write (&rank->ipriority[REG_RANK_INDEX (8 , +vgic_byte_write (&rank->ipriorityr[REG_RANK_INDEX (8 , reg -GICD_IPRIORITYR ,DABT_WORD )], r, reg);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -1035,18 +1035,6 @@ static const struct mmio_handler_ops vgic_distr_mmio_handler = { .write = vgic_v3_distr_mmio_write, }; -static int vgic_v3_get_irq_priority (struct vcpu *v,unsigned int irq) -{ -int priority; -struct vgic_irq_rank *rank =vgic_rank_irq (v, irq); - -ASSERT (spin_is_locked (&rank->lock)); - priority =vgic_byte_read (rank->ipriority[REG_RANK_INDEX (8 , - irq,DABT_WORD )], irq &0x3 ); - -return priority; -} -static int vgic_v3_vcpu_init (struct vcpu *v) {int i;
@@ -1196,7 +1184,6 @@ static int vgic_v3_domain_init(struct domain *d)static const struct vgic_ops v3_ops = { .vcpu_init = vgic_v3_vcpu_init, .domain_init = vgic_v3_domain_init, - .get_irq_priority = vgic_v3_get_irq_priority, .get_target_vcpu = vgic_v3_get_target_vcpu, .emulate_sysreg = vgic_v3_emulate_sysreg,/*
xen/arch/arm/vgic.c +14 -4
@@ -204,6 +204,19 @@ struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq)return v_target; } +static int vgic_get_virq_priority (struct vcpu *v,unsigned int virq) +{ +struct vgic_irq_rank *rank =vgic_rank_irq (v, virq); +unsigned long flags; +int priority; + +vgic_lock_rank (v, rank, flags); + priority = rank->priority[virq &INTERRUPT_RANK_MASK ]; +vgic_unlock_rank (v, rank, flags); + +return priority; +} +void vgic_migrate_irq (struct vcpu *old,struct vcpu *new,unsigned int irq) {unsigned long flags;
@@ -407,14 +420,11 @@ void vgic_clear_pending_irqs(struct vcpu *v)void vgic_vcpu_inject_irq (struct vcpu *v,unsigned int virq) {uint8_t priority; -struct vgic_irq_rank *rank =vgic_rank_irq (v, virq);struct pending_irq *iter, *n =irq_to_pending (v, virq);unsigned long flags;bool_t running; -vgic_lock_rank (v, rank, flags); - priority = v->domain->arch.vgic.handler->get_irq_priority (v, virq); -vgic_unlock_rank (v, rank, flags); + priority =vgic_get_virq_priority (v, virq);spin_lock_irqsave (&v->arch.vgic.lock, flags);
xen/include/asm-arm/vgic.h +14 -3
@@ -82,12 +82,25 @@ struct pending_irqstruct list_head lr_queue; }; +#define NR_INTERRUPT_PER_RANK 32 +#define INTERRUPT_RANK_MASK (NR_INTERRUPT_PER_RANK - 1) +/* Represents state corresponding to a block of 32 interrupts */ struct vgic_irq_rank { spinlock_t lock; /* Covers access to all other members of this struct */ uint32_t ienable; uint32_t icfg[2]; - uint32_t ipriority[8]; + + /* + * Provide efficient access to the priority of an vIRQ while keeping + * the emulation simple. + * Note, this is working fine as long as Xen is using little endian. + */ + union { + uint8_t priority[32]; + uint32_t ipriorityr[8]; + }; + union { struct { uint32_t itargets[8];
@@ -114,8 +127,6 @@ struct vgic_ops {int (*vcpu_init)(struct vcpu *v);/* Domain specific initialization of vGIC */ int (*domain_init)(struct domain *d); -/* Get priority for a given irq stored in vgic structure */ -int (*get_irq_priority)(struct vcpu *v,unsigned int irq);/* Get the target vcpu for a given virq. The rank lock is already taken * when calling this. */ struct vcpu *(*get_target_vcpu)(struct vcpu *v,unsigned int irq);
Signature · 1 line
2.1.4
PATCH v3 6/9 xen/arm: vgic: Introduce a new field to store the rank index and use it
In reply to Julien GrallHaving in hand the index for the rank is very handy to avoid computing it every time.
For now, use it when enabling/disabling the vIRQs rather than a formula which is not obvious to understand.
Also drop the comments which were wrong because a shift by DABT_WORD will not give the IRQ number but the index of the register.
---
Changes in v3:
- Add missing signed-off-by
- Typoes in the commit message
- Add Ian's acked-by
Changes in v2:
- Patch added
--- xen/arch/arm/vgic-v2.c | 12 ++---------- xen/arch/arm/vgic-v3.c | 6 ++---- xen/arch/arm/vgic.c | 13 ++++++++++--- xen/include/asm-arm/vgic.h | 3 +++ 4 files changed, 17 insertions(+), 17 deletions(-)
xen/arch/arm/vgic-v2.c +2 -10
@@ -288,11 +288,7 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,vgic_lock_rank (v, rank, flags); tr = rank->ienable; rank->ienable |= r; -/* The virtual irq is derived from register offset. -* The register difference is word difference. So divide by 2(DABT_WORD) -* to get Virtual irq number */ -vgic_enable_irqs (v, r & (~tr), - (gicd_reg -GICD_ISENABLER ) >>DABT_WORD ); +vgic_enable_irqs (v, r & (~tr), rank->index);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -303,11 +299,7 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,vgic_lock_rank (v, rank, flags); tr = rank->ienable; rank->ienable &= ~r; -/* The virtual irq is derived from register offset. -* The register difference is word difference. So divide by 2(DABT_WORD) -* to get Virtual irq number */ -vgic_disable_irqs (v, r & tr, - (gicd_reg -GICD_ICENABLER ) >>DABT_WORD ); +vgic_disable_irqs (v, r & tr, rank->index);vgic_unlock_rank (v, rank, flags);return 1 ;
xen/arch/arm/vgic-v3.c +2 -4
@@ -386,8 +386,7 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,vgic_lock_rank (v, rank, flags); tr = rank->ienable; rank->ienable |= r; -/* The irq number is extracted from offset. so shift by register size */ -vgic_enable_irqs (v, r & (~tr), (reg -GICD_ISENABLER ) >>DABT_WORD ); +vgic_enable_irqs (v, r & (~tr), rank->index);vgic_unlock_rank (v, rank, flags);return 1 ; case GICD_ICENABLER ... GICD_ICENABLERN:
@@ -397,8 +396,7 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,vgic_lock_rank (v, rank, flags); tr = rank->ienable; rank->ienable &= ~r; -/* The irq number is extracted from offset. so shift by register size */ -vgic_disable_irqs (v, r & tr, (reg -GICD_ICENABLER ) >>DABT_WORD ); +vgic_disable_irqs (v, r & tr, rank->index);vgic_unlock_rank (v, rank, flags);return 1 ; case GICD_ISPENDR ... GICD_ISPENDRN:
xen/arch/arm/vgic.c +10 -3
@@ -68,6 +68,13 @@ static void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq) p->irq = virq; } +static void vgic_rank_init (struct vgic_irq_rank *rank,uint8_t index) +{ +spin_lock_init (&rank->lock); + + rank->index = index; +} +int domain_vgic_init (struct domain *d,unsigned int nr_spis) {int i;
@@ -114,8 +121,8 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)for (i=0 ; i<d->arch.vgic.nr_spis; i++)vgic_init_pending_irq (&d->arch.vgic.pending_irqs[i], i +32 ); -for (i=0 ; i<DOMAIN_NR_RANKS (d); i++) -spin_lock_init (&d->arch.vgic.shared_irqs[i].lock); +for ( i =0 ; i <DOMAIN_NR_RANKS (d); i++ ) +vgic_rank_init (&d->arch.vgic.shared_irqs[i], i +1 ); ret = d->arch.vgic.handler->domain_init (d);if ( ret )
@@ -169,7 +176,7 @@ int vcpu_vgic_init(struct vcpu *v)if ( v->arch.vgic.private_irqs ==NULL )return -ENOMEM ; -spin_lock_init (&v->arch.vgic.private_irqs->lock); +vgic_rank_init (v->arch.vgic.private_irqs,0 ); v->domain->arch.vgic.handler->vcpu_init (v);
xen/include/asm-arm/vgic.h +3 -0
@@ -88,6 +88,9 @@ struct pending_irq/* Represents state corresponding to a block of 32 interrupts */ struct vgic_irq_rank {spinlock_t lock;/* Covers access to all other members of this struct */ + +uint8_t index; +uint32_t ienable;uint32_t icfg[2 ];
Signature · 1 line
2.1.4
PATCH v3 7/9 xen/arm: vgic: Optimize the way to store the target vCPU in the rank
In reply to Julien GrallXen is currently directly storing the value of GICD_ITARGETSR register (for GICv2) and GICD_IROUTER (for GICv3) in the rank. This makes the emulation of the registers access very simple but makes the code to get the target vCPU for a given vIRQ more complex.
While the target vCPU of an vIRQ is retrieved every time an vIRQ is injected to the guest, the access to the register occurs less often.
So the data structure should be optimized for the most common case rather than the inverse.
This patch introduces the usage of an array to store the target vCPU for every interrupt in the rank. This will make the code to get the target very quick. The emulation code will now have to generate the GICD_ITARGETSR and GICD_IROUTER register for read access and split it to store in a convenient way.
With the new way to store the target vCPU, the structure vgic_irq_rank is shrunk down from 320 bytes to 92 bytes. This is saving about 228 bytes of memory allocated separately per vCPU.
Note that with these changes, any read to those registers will list only the target vCPU used by Xen. We think this is likely to be OK because the GIC spec doesn't require to return exactly the value written and it can be seen as if we decide to implement the register read-only.
Furthermore, the implementation of the callback get_target_vcpu is now exactly the same. Consolidate the implementation in the common vGIC code and drop the callback.
Finally take the opportunity to fix coding style and replace "irq" by "virq" to make clear that we are dealing with virtual IRQ in section we are modifying.
---
The real reason is I'd like to drop vgic_byte_* helpers in favor of more generic access helpers. Although it would make the code to retrieve the priority more complex. So reworking the code to get the target vCPU was the best solution.
Changes in v3:
- Make clear in the commit message that we rely on a corner case of the spec.
- Typoes
Changes in v2:
- Remove get_target_vcpu callback
- s/irq/virq/ to make clear we are using virtual IRQ
- Update the commit message
- Rename vgic_generate_* to vgic_fetch
- Improve code comment
- Move the introduction of vgic_rank_init in a separate patch
- Make use of rank->idx
Changes in v1:
- Patch added
--- xen/arch/arm/vgic-v2.c | 184 +++++++++++++++++++++++++-------------------- xen/arch/arm/vgic-v3.c | 119 +++++++++++++++-------------- xen/arch/arm/vgic.c | 45 ++++++++--- xen/include/asm-arm/vgic.h | 18 ++--- 4 files changed, 207 insertions(+), 159 deletions(-)
xen/arch/arm/vgic-v2.c +103 -81
@@ -50,6 +50,97 @@ void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t vbase) vgic_v2_hw.vbase = vbase; } +#define NR_TARGET_PER_REG 4U +#define NR_BIT_PER_TARGET 8U + +/* +* Fetch a ITARGETSR register based on the offset from ITARGETSR0. Only +* one vCPU will be listed for a given vIRQ. +* +* Note the offset will be aligned to the appropriate boundary. +*/ +static uint32_t vgic_fetch_itargetsr (struct vgic_irq_rank *rank, +unsigned int offset) +{ +uint32_t reg =0 ; +unsigned int i; + +ASSERT (spin_is_locked (&rank->lock)); + + offset &=INTERRUPT_RANK_MASK ; + offset &= ~(NR_TARGET_PER_REG -1 ); + +for ( i =0 ; i <NR_TARGET_PER_REG ; i++, offset++ ) + reg |= (1 << rank->vcpu[offset]) << (i *NR_BIT_PER_TARGET ); + +return reg; +} + +/* +* Store a ITARGETSR register in a convenient way and migrate the vIRQ +* if necessary. This function only deals with ITARGETSR8 and onwards. +* +* Note the offset will be aligned to the appropriate boundary. +*/ +static void vgic_store_itargetsr (struct domain *d,struct vgic_irq_rank *rank, +unsigned int offset,uint32_t itargetsr) +{ +unsigned int i; + +ASSERT (spin_is_locked (&rank->lock)); + +/* +* The ITARGETSR0-7, used for SGIs/PPIs, are implemented RO in the +* emulation and should never call this function. +* +* They all live in the first rank. +*/ +BUILD_BUG_ON (NR_INTERRUPT_PER_RANK !=32 ); +ASSERT (rank->index >=1 ); + + offset &=INTERRUPT_RANK_MASK ; + offset &= ~(NR_TARGET_PER_REG -1 ); + +for ( i =0 ; i <NR_TARGET_PER_REG ; i++, offset++ ) + { +unsigned int new_target, old_target; + +/* +* SPIs are using the 1-N model (see 1.4.3 in ARM IHI 0048B). +* While the interrupt could be set pending to all the vCPUs in +* target list, it's not guarantee by the spec. +* For simplicity, always route the vIRQ to the first interrupt +* in the target list +*/ + new_target =ffs (itargetsr & ((1 <<NR_BIT_PER_TARGET ) -1 )); + old_target = rank->vcpu[offset]; + + itargetsr >>=NR_BIT_PER_TARGET ; + +/* +* Ignore the write request for this interrupt if the new target +* is invalid. +*/ +if ( !new_target || (new_target > d->max_vcpus) ) +continue ; + +/* The vCPU ID always start from 0 */ + new_target--; + +/* Only migrate the vIRQ if the target vCPU has changed */ +if ( new_target != old_target ) + { +unsigned int virq = rank->index *NR_INTERRUPT_PER_RANK + offset; + +vgic_migrate_irq (d->vcpu[old_target], + d->vcpu[new_target], + virq); + } + + rank->vcpu[offset] = new_target; + } +} +static int vgic_v2_distr_mmio_read (struct vcpu *v,mmio_info_t *info,register_t *r,void *priv) {
@@ -126,8 +217,7 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info, rank =vgic_rank_offset (v,8 , gicd_reg -GICD_ITARGETSR ,DABT_WORD );if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->v2.itargets[REG_RANK_INDEX (8 , gicd_reg -GICD_ITARGETSR , -DABT_WORD )]; + *r =vgic_fetch_itargetsr (rank, gicd_reg -GICD_ITARGETSR );if ( dabt.size ==DABT_BYTE ) *r =vgic_byte_read (*r, gicd_reg);vgic_unlock_rank (v, rank, flags);
@@ -337,56 +427,21 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info, case GICD_ITARGETSR + 8 ... GICD_ITARGETSRN: { -/* unsigned long needed for find_next_bit */ -unsigned long target; -int i; +uint32_t itargetsr; +if ( dabt.size !=DABT_BYTE && dabt.size !=DABT_WORD ) goto bad_width; rank =vgic_rank_offset (v,8 , gicd_reg -GICD_ITARGETSR ,DABT_WORD );if ( rank ==NULL ) goto write_ignore; -/* 8-bit vcpu mask for this domain */ -BUG_ON (v->domain->max_vcpus >8 ); - target = (1 << v->domain->max_vcpus) -1 ; -if ( dabt.size ==2 ) - target = target | (target <<8 ) | (target <<16 ) | (target <<24 ); -else - target = (target << (8 * (gicd_reg &0x3 ))); - target &= r; -/* ignore zero writes */ -if ( !target ) - goto write_ignore; -/* For word reads ignore writes where any single byte is zero */ -if ( dabt.size ==2 && - !((target &0xff ) && (target & (0xff <<8 )) && - (target & (0xff <<16 )) && (target & (0xff <<24 )))) - goto write_ignore;vgic_lock_rank (v, rank, flags); - i =0 ; -while ( (i =find_next_bit (&target,32 , i)) <32 ) - { -unsigned int irq, new_target, old_target; -unsigned long old_target_mask; -struct vcpu *v_target, *v_old; - - new_target = i %8 ; - old_target_mask =vgic_byte_read (rank->v2.itargets[REG_RANK_INDEX (8 , - gicd_reg -GICD_ITARGETSR ,DABT_WORD )], i/8 ); - old_target =find_first_bit (&old_target_mask,8 ); - -if ( new_target != old_target ) - { - irq = gicd_reg -GICD_ITARGETSR + (i /8 ); - v_target = v->domain->vcpu[new_target]; - v_old = v->domain->vcpu[old_target]; -vgic_migrate_irq (v_old, v_target, irq); - } - i +=8 - new_target; - }if ( dabt.size ==DABT_WORD ) - rank->v2.itargets[REG_RANK_INDEX (8 , gicd_reg -GICD_ITARGETSR , -DABT_WORD )] = target; + itargetsr = r;else -vgic_byte_write (&rank->v2.itargets[REG_RANK_INDEX (8 , - gicd_reg -GICD_ITARGETSR ,DABT_WORD )], target, gicd_reg); + { + itargetsr =vgic_fetch_itargetsr (rank, gicd_reg -GICD_ITARGETSR ); +vgic_byte_write (&itargetsr, r, gicd_reg); + } +vgic_store_itargetsr (v->domain, rank, gicd_reg -GICD_ITARGETSR , + itargetsr);vgic_unlock_rank (v, rank, flags);return 1 ; }
@@ -487,43 +542,16 @@ static const struct mmio_handler_ops vgic_v2_distr_mmio_handler = { .write = vgic_v2_distr_mmio_write, }; -static struct vcpu *vgic_v2_get_target_vcpu (struct vcpu *v,unsigned int irq) -{ -unsigned long target; -struct vcpu *v_target; -struct vgic_irq_rank *rank =vgic_rank_irq (v, irq); -ASSERT (spin_is_locked (&rank->lock)); - - target =vgic_byte_read (rank->v2.itargets[REG_RANK_INDEX (8 , - irq,DABT_WORD )], irq &0x3 ); - -/* 1-N SPI should be delivered as pending to all the vcpus in the -* mask, but here we just return the first vcpu for simplicity and -* because it would be too slow to do otherwise. */ - target =find_first_bit (&target,8 ); -ASSERT (target >=0 && target < v->domain->max_vcpus); - v_target = v->domain->vcpu[target]; -return v_target; -} -static int vgic_v2_vcpu_init (struct vcpu *v) { -int i; - -/* For SGI and PPI the target is always this CPU */ -for ( i =0 ; i <8 ; i++ ) - v->arch.vgic.private_irqs->v2.itargets[i] = - (1 <<(v->vcpu_id+0 )) - | (1 <<(v->vcpu_id+8 )) - | (1 <<(v->vcpu_id+16 )) - | (1 <<(v->vcpu_id+24 )); +/* Nothing specific to initialize for this driver */ return 0 ; }static int vgic_v2_domain_init (struct domain *d) { -int i, ret; +int ret;paddr_t cbase;/*
@@ -563,11 +591,6 @@ static int vgic_v2_domain_init(struct domain *d)if ( ret )return ret; -/* By default deliver to CPU0 */ -for ( i =0 ; i <DOMAIN_NR_RANKS (d); i++ ) -memset (d->arch.vgic.shared_irqs[i].v2.itargets,0x1 , -sizeof (d->arch.vgic.shared_irqs[i].v2.itargets)); -register_mmio_handler (d, &vgic_v2_distr_mmio_handler, d->arch.vgic.dbase,PAGE_SIZE ,NULL );
@@ -577,7 +600,6 @@ static int vgic_v2_domain_init(struct domain *d)static const struct vgic_ops vgic_v2_ops = { .vcpu_init = vgic_v2_vcpu_init, .domain_init = vgic_v2_domain_init, - .get_target_vcpu = vgic_v2_get_target_vcpu, .max_vcpus =8 , };
xen/arch/arm/vgic-v3.c +64 -55
179 lines not on this page · raw message
xen/arch/arm/vgic.c +34 -11
105 lines not on this page · raw message
xen/include/asm-arm/vgic.h +6 -12
@@ -104,14 +104,11 @@ struct vgic_irq_rank {uint32_t ipriorityr[8 ]; }; -union { -struct { -uint32_t itargets[8 ]; - }v2; -struct { -uint64_t irouter[32 ]; - }v3; - }; +/* +* It's more convenient to store a target VCPU per vIRQ +* than the register ITARGETSR/IROUTER itself +*/ +uint8_t vcpu[32 ]; };struct sgi_target {
@@ -130,9 +127,6 @@ struct vgic_ops {int (*vcpu_init)(struct vcpu *v);/* Domain specific initialization of vGIC */ int (*domain_init)(struct domain *d); -/* Get the target vcpu for a given virq. The rank lock is already taken -* when calling this. */ -struct vcpu *(*get_target_vcpu)(struct vcpu *v,unsigned int irq);/* vGIC sysreg emulation */ int (*emulate_sysreg)(struct cpu_user_regs *regs,union hsr hsr);/* Maximum number of vCPU supported */
@@ -205,7 +199,7 @@ enum gic_sgi_mode;extern int domain_vgic_init (struct domain *d,unsigned int nr_spis);extern void domain_vgic_free (struct domain *d);extern int vcpu_vgic_init (struct vcpu *v); -extern struct vcpu *vgic_get_target_vcpu (struct vcpu *v,unsigned int irq); +extern struct vcpu *vgic_get_target_vcpu (struct vcpu *v,unsigned int virq);extern void vgic_vcpu_inject_irq (struct vcpu *v,unsigned int virq);extern void vgic_vcpu_inject_spi (struct domain *d,unsigned int virq);extern void vgic_clear_pending_irqs (struct vcpu *v);
Signature · 1 line
2.1.4
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 4 lines · Julien Grall
Note that with these changes, any read to those registers will list only the target vCPU used by Xen. We think this is likely to be OK because the GIC spec doesn't require to return exactly the value written and it can be seen as if we decide to implement the register read-only.
This still isn't true.
The GIC spec requires one of two modes: Either the register is read-only _or_ it is writable and one can expect to read back what was written (because the spec doesn't say otherwise and doing otherwise would definitely be exceptional behaviour).
This comment needs to explain why believe we are able to get away with implementing a third option despite that, i.e. why we think it is ok to push the boundaries of the spec here.
At no point should the behaviour implemented be compared to implementing the register as read-only, because that is a bogus comparison. A register cannot be "sort of read-only" and justifying the behaviour here on that basis is incorrect.
Quoted 3 lines
Changes in v3:
- Make clear in the commit message that we rely on a corner case of the spec.
No we don't. We do something out of spec which we think we can get away with implementing as we have done.
Ian.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Julien Grall
Note that with these changes, any read to those registers will list only the target vCPU used by Xen. We think this is likely to be OK because the GIC spec doesn't require to return exactly the value written and it can be seen as if we decide to implement the register read-only.
This still isn't true.
I understood you previous answer on v2 as please replace "this is fine..." by "We think this is likely to be OK because..."....
Quoted 4 lines
The GIC spec requires one of two modes: Either the register is read-only _or_ it is writable and one can expect to read back what was written (because the spec doesn't say otherwise and doing otherwise would definitely be exceptional behaviour).
How can you say that the spec requires the second mode? Nothing in the spec say that you can expect to read back what was written...
The spec only says what you the format of the register and what you may expect to read if the register is read-only. Other than that it's completely blur and you can implement whatever you want.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 10 lines · Julien Grall
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Julien Grall
Note that with these changes, any read to those registers will list only
the target vCPU used by Xen. We think this is likely to be OK because the
GIC spec doesn't require to return exactly the value written and it can
be seen as if we decide to implement the register read-only.
Quoted 4 lines
Quoted 1 line
This still isn't true.
I understood you previous answer on v2 as please replace "this is fine..." by "We think this is likely to be OK because..."....
Sorry, I meant ... as "and go on to explain it as we've been discussing".
Quoted 8 lines
Quoted 5 lines
The GIC spec requires one of two modes: Either the register is read -only
_or_ it is writable and one can expect to read back what was written (because the spec doesn't say otherwise and doing otherwise would definitely be exceptional behaviour).How can you say that the spec requires the second mode? Nothing in the spec say that you can expect to read back what was written...
Because that is so clearly and obviously the only sane default for a read write register that nobody even bothers to say it. They specify when it is not the case that you get back what you wrote by defining what you get on read.
Quoted 3 lines
The spec only says what you the format of the register and what you may expect to read if the register is read-only. Other than that it's completely blur and you can implement whatever you want.
Regardless, I am not acking in a patch which implies we think this behaviour is justified by the spec as this one currently does.
Ian.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 24 lines · Ian Campbell
Quoted 10 lines · Julien Grall
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Julien Grall
Note that with these changes, any read to those registers will list only
the target vCPU used by Xen. We think this is likely to be OK because the
GIC spec doesn't require to return exactly the value written and it can
be seen as if we decide to implement the register read-only.Quoted 4 lines
Quoted 1 line
This still isn't true.
I understood you previous answer on v2 as please replace "this is fine..." by "We think this is likely to be OK because..."....
Sorry, I meant ... as "and go on to explain it as we've been discussing".
Quoted 6 lines
Quoted 5 lines
The GIC spec requires one of two modes: Either the register is read -only
_or_ it is writable and one can expect to read back what was written (because the spec doesn't say otherwise and doing otherwise would definitely be exceptional behaviour).
Quoted 7 lines
Quoted 2 lines
How can you say that the spec requires the second mode? Nothing in the spec say that you can expect to read back what was written...
Because that is so clearly and obviously the only sane default for a read write register that nobody even bothers to say it. They specify when it is not the case that you get back what you wrote by defining what you get on read.
Well that's not obvious for me...
Quoted 6 lines
Quoted 3 lines
The spec only says what you the format of the register and what you may expect to read if the register is read-only. Other than that it's completely blur and you can implement whatever you want.
Regardless, I am not acking in a patch which implies we think this behaviour is justified by the spec as this one currently does.
TBH, I don't see how I can justify that what we are doing is fine except by saying "for simplicity".
If you think this is not justify by the spec, then maybe we should just drop this patch. It's nice to have it but not strictly mandatory.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 39 lines · Julien Grall
Quoted 24 lines · Ian Campbell
Quoted 10 lines · Julien Grall
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Julien Grall
Note that with these changes, any read to those registers will list only
the target vCPU used by Xen. We think this is likely to be OK because the
GIC spec doesn't require to return exactly the value written and it can
be seen as if we decide to implement the register read-only.Quoted 4 lines
Quoted 1 line
This still isn't true.
I understood you previous answer on v2 as please replace "this is fine..." by "We think this is likely to be OK because..."....
Sorry, I meant ... as "and go on to explain it as we've been discussing".
Quoted 6 lines
Quoted 5 lines
The GIC spec requires one of two modes: Either the register is read -only
_or_ it is writable and one can expect to read back what was written (because the spec doesn't say otherwise and doing otherwise would definitely be exceptional behaviour).Quoted 7 lines
Quoted 2 lines
How can you say that the spec requires the second mode? Nothing in the spec say that you can expect to read back what was written...
Because that is so clearly and obviously the only sane default for a read write register that nobody even bothers to say it. They specify when it is not the case that you get back what you wrote by defining what you get on read.
Well that's not obvious for me...
Quoted 4 lines
Quoted 3 lines
The spec only says what you the format of the register and what you may expect to read if the register is read-only. Other than that it's completely blur and you can implement whatever you want.
Quoted 5 lines
Quoted 2 lines
Regardless, I am not acking in a patch which implies we think this behaviour is justified by the spec as this one currently does.
TBH, I don't see how I can justify that what we are doing is fine except by saying "for simplicity".
I though a bit more about it. We are both interpreting the spec differently and I think both are valid. So hardware people and OS developer may also lean toward one of them.
Mine is more restrictive than yours, as you said on v1, it would hit picky OS that follow your interpretation and read back the register to check either the value is exactly the one written and/or the previous value. Although it make the implementation simpler and save memory.
How about:
"Note that with these changes, any read to those registers will list only the target vCPU used by Xen. As the spec is not clear whether this is a valid choice or not, picky OSes (i.e which read back register to check the value written) which have a different interpretation of the spec may not boot anymore on Xen. Although, I think this is a fair trade between memory usage in Xen (1KB on a domain using 4 vCPUs with no SPIs) and a strict interpretation of the spec (though all the cases are not clearly defined)".
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 3 lines · Julien Grall
Quoted 2 lines · Julien Grall
TBH, I don't see how I can justify that what we are doing is fine except by saying "for simplicity".
I think it is also fine to say that we currently expect that in reality OSes won't rely on being able to read-back from this register.
Quoted 3 lines
I though a bit more about it. We are both interpreting the spec differently and I think both are valid. So hardware people and OS developer may also lean toward one of them.
TBH I don't agree, your definition essentially turns any RW register which does not specify precisely otherwise into a WO register.
Quoted 7 lines
Mine is more restrictive than yours, as you said on v1, it would hit picky OS that follow your interpretation and read back the register to check either the value is exactly the one written and/or the previous value. Although it make the implementation simpler and save memory.
How about:
Quoted 8 lines
"Note that with these changes, any read to those registers will list only the target vCPU used by Xen. As the spec is not clear whether this is a valid choice or not, picky OSes (i.e which read back register to check the value written) which have a different interpretation of the spec may not boot anymore on Xen. Although, I think this is a fair trade between memory usage in Xen (1KB on a domain using 4 vCPUs with no SPIs) and a strict interpretation of the spec (though all the cases are not clearly defined)".
That's OK. I'd prefer to drop the "picky" and to make the "(i.e. ....)" in the middle to say something like "(i.e. OSes which perform read-modify -write operations on these registers"), which is not a picky thing to want to do even if we don't expect any OS to actually to it.
BTW, IHI 0069A says 8.9.17:
When affinity routing is not enabled, holds the list of target PEs for the interrupt. That is, it holds the list of CPU interfaces to which the Distributor forwards the interrupt if it is asserted and has sufficient priority.
Which isn't actually inconsistent with the register reading back the set of CPUs to which the interrupt is actually going to end up being routed (i.e. the behaviour of this patch).
However I think this has gone on long enough and some text which says it isn't clear is still a reasonable thing to write.
Ian.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 31 lines · Ian Campbell
Quoted 3 lines · Julien Grall
Quoted 2 lines · Julien Grall
TBH, I don't see how I can justify that what we are doing is fine except by saying "for simplicity".
I think it is also fine to say that we currently expect that in reality OSes won't rely on being able to read-back from this register.
Quoted 3 lines
I though a bit more about it. We are both interpreting the spec differently and I think both are valid. So hardware people and OS developer may also lean toward one of them.
TBH I don't agree, your definition essentially turns any RW register which does not specify precisely otherwise into a WO register.
Quoted 7 lines
Mine is more restrictive than yours, as you said on v1, it would hit picky OS that follow your interpretation and read back the register to check either the value is exactly the one written and/or the previous value. Although it make the implementation simpler and save memory.
How about:
Quoted 8 lines
"Note that with these changes, any read to those registers will list only the target vCPU used by Xen. As the spec is not clear whether this is a valid choice or not, picky OSes (i.e which read back register to check the value written) which have a different interpretation of the spec may not boot anymore on Xen. Although, I think this is a fair trade between memory usage in Xen (1KB on a domain using 4 vCPUs with no SPIs) and a strict interpretation of the spec (though all the cases are not clearly defined)".
Quoted 4 lines
That's OK. I'd prefer to drop the "picky" and to make the "(i.e. ....)" in the middle to say something like "(i.e. OSes which perform read-modify -write operations on these registers"), which is not a picky thing to want to do even if we don't expect any OS to actually to it.
I will update the commit message.
Quoted 6 lines
BTW, IHI 0069A says 8.9.17:
When affinity routing is not enabled, holds the list of target PEs for the interrupt. That is, it holds the list of CPU interfaces to which the Distributor forwards the interrupt if it is asserted and has sufficient priority.
I read multiple time the ITARGETSR section and somehow miss this paragraph.
Quoted 7 lines
Which isn't actually inconsistent with the register reading back the set of CPUs to which the interrupt is actually going to end up being routed (i.e. the behaviour of this patch).
However I think this has gone on long enough and some text which says it isn't clear is still a reasonable thing to write.
I will resend a new version after I got an answer from Stefano on [1].
Regards,
[1] http://lists.xen.org/archives/html/xen-devel/2015-10/msg00893.html
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
In reply to Julien GrallQuoted 54 lines · Julien Grall
xen/arch/arm/vgic-v2.c +54
-0+/* +* Store a ITARGETSR register in a convenient way and migrate the vIRQ +* if necessary. This function only deals with ITARGETSR8 and onwards. +* +* Note the offset will be aligned to the appropriate boundary. +*/ +static void vgic_store_itargetsr (struct domain *d,struct vgic_irq_rank *rank, +unsigned int offset,uint32_t itargetsr) +{ +unsigned int i; + +ASSERT (spin_is_locked (&rank->lock)); + +/* +* The ITARGETSR0-7, used for SGIs/PPIs, are implemented RO in the +* emulation and should never call this function. +* +* They all live in the first rank. +*/ +BUILD_BUG_ON (NR_INTERRUPT_PER_RANK !=32 ); +ASSERT (rank->index >=1 ); + + offset &=INTERRUPT_RANK_MASK ; + offset &= ~(NR_TARGET_PER_REG -1 ); + +for ( i =0 ; i <NR_TARGET_PER_REG ; i++, offset++ ) + { +unsigned int new_target, old_target; + +/* +* SPIs are using the 1-N model (see 1.4.3 in ARM IHI 0048B). +* While the interrupt could be set pending to all the vCPUs in +* target list, it's not guarantee by the spec. +* For simplicity, always route the vIRQ to the first interrupt +* in the target list +*/ + new_target =ffs (itargetsr & ((1 <<NR_BIT_PER_TARGET ) -1 )); + old_target = rank->vcpu[offset]; + + itargetsr >>=NR_BIT_PER_TARGET ; + +/* +* Ignore the write request for this interrupt if the new target +* is invalid. +*/ +if ( !new_target || (new_target > d->max_vcpus) ) +continue ; + +/* The vCPU ID always start from 0 */ + new_target--; + +/* Only migrate the vIRQ if the target vCPU has changed */ +if ( new_target != old_target ) + {
xen/arch/arm/vgic-v2.c void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t vbase) · line 142
Quoted 10 lines
xen/arch/arm/vgic-v2.c +10
-0+unsigned int virq = rank->index *NR_INTERRUPT_PER_RANK + offset; + +vgic_migrate_irq (d->vcpu[old_target], + d->vcpu[new_target], + virq); + } + + rank->vcpu[offset] = new_target; + } +}
This introduces a behavioural change: previously 32-bit writes which contained one 0 byte would be ignored in their entirety. See:
http://marc.info/?l=xen-devel&m=140431564123221
Even though I am not entirely sure about which one is the correct behaviour according to the spec, I prefer the old one because I think it is less surprising to users.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 69 lines · Stefano Stabellini
Quoted 54 lines · Julien Grall
xen/arch/arm/vgic-v2.c +54
-0+/* +* Store a ITARGETSR register in a convenient way and migrate the vIRQ +* if necessary. This function only deals with ITARGETSR8 and onwards. +* +* Note the offset will be aligned to the appropriate boundary. +*/ +static void vgic_store_itargetsr (struct domain *d,struct vgic_irq_rank *rank, +unsigned int offset,uint32_t itargetsr) +{ +unsigned int i; + +ASSERT (spin_is_locked (&rank->lock)); + +/* +* The ITARGETSR0-7, used for SGIs/PPIs, are implemented RO in the +* emulation and should never call this function. +* +* They all live in the first rank. +*/ +BUILD_BUG_ON (NR_INTERRUPT_PER_RANK !=32 ); +ASSERT (rank->index >=1 ); + + offset &=INTERRUPT_RANK_MASK ; + offset &= ~(NR_TARGET_PER_REG -1 ); + +for ( i =0 ; i <NR_TARGET_PER_REG ; i++, offset++ ) + { +unsigned int new_target, old_target; + +/* +* SPIs are using the 1-N model (see 1.4.3 in ARM IHI 0048B). +* While the interrupt could be set pending to all the vCPUs in +* target list, it's not guarantee by the spec. +* For simplicity, always route the vIRQ to the first interrupt +* in the target list +*/ + new_target =ffs (itargetsr & ((1 <<NR_BIT_PER_TARGET ) -1 )); + old_target = rank->vcpu[offset]; + + itargetsr >>=NR_BIT_PER_TARGET ; + +/* +* Ignore the write request for this interrupt if the new target +* is invalid. +*/ +if ( !new_target || (new_target > d->max_vcpus) ) +continue ; + +/* The vCPU ID always start from 0 */ + new_target--; + +/* Only migrate the vIRQ if the target vCPU has changed */ +if ( new_target != old_target ) + {xen/arch/arm/vgic-v2.c void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t vbase) · line 142
Quoted 10 lines
xen/arch/arm/vgic-v2.c +10
-0+unsigned int virq = rank->index *NR_INTERRUPT_PER_RANK + offset; + +vgic_migrate_irq (d->vcpu[old_target], + d->vcpu[new_target], + virq); + } + + rank->vcpu[offset] = new_target; + } +}This introduces a behavioural change: previously 32-bit writes which contained one 0 byte would be ignored in their entirety. See:
Quoted 1 line
It's true that this may change the behavior of a guest writing the ITARGETSR with a byte to 0. But what's the point to have a guest relying on its write to be ignored?
Aside that, I don't think we are bound to emulate exactly the same behavior in each version of Xen. We may decide to slightly change it because we have to rework the code to get a common emulation or fix a bug.
Quoted 4 lines
Even though I am not entirely sure about which one is the correct behaviour according to the spec, I prefer the old one because I think it is less surprising to users.
How ignoring the whole write would be less surprising? ;) There is no warning at all, so it's very difficult for the user to know why the write has been ignored.
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register field corresponding to an unimplemented interrupt is RAZ/WI."
If the user knows that an interrupt is not implemented, he may decide to write 0 in the corresponding byte. With the current solution, the whole write access is ignored.
The solution suggested in this patch is less restrictive and will just ignore the corresponding byte if it's 0.
On another side, nothing in the spec specified what happen if the target field is 0 for a valid interrupt. But I think this is OK to just ignore it and carry on. It's simpler to implement.
I didn't mention this such things in the commit message. I will update it if we decide to carry on with this patch.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 9 lines · Julien Grall
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register field corresponding to an unimplemented interrupt is RAZ/WI."
If the user knows that an interrupt is not implemented, he may decide to write 0 in the corresponding byte. With the current solution, the whole write access is ignored.
The solution suggested in this patch is less restrictive and will just ignore the corresponding byte if it's 0.
I think this (a 32-bit register covering both implemented and non -implemented interrupts) is a compelling reason to only ignore the specific zero bytes and not the whole word.
Quoted 3 lines
On another side, nothing in the spec specified what happen if the target field is 0 for a valid interrupt. But I think this is OK to just ignore it and carry on. It's simpler to implement.
On a (not very) related notes, these registers are res0 when affinity routing is enabled on gic-v3 (which I think is our hardcoded configuration) and I noticed that vgic_v3_distr_mmio_read doesn't look to implement that explicitly, hence it uses the default case which logs. Probably we should add a proper handler which silently does RAZ/WI?
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Julien Grall
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register field corresponding to an unimplemented interrupt is RAZ/WI."
If the user knows that an interrupt is not implemented, he may decide to write 0 in the corresponding byte. With the current solution, the whole write access is ignored.
Quoted 6 lines
Quoted 2 lines
The solution suggested in this patch is less restrictive and will just ignore the corresponding byte if it's 0.
I think this (a 32-bit register covering both implemented and non -implemented interrupts) is a compelling reason to only ignore the specific zero bytes and not the whole word.
I agree that zero writes to unimplemented interrupts should be allowed. However allowing them for everything encourages 32-bit writes with just one byte set, the one that the OS actually wants to write. It doesn't seem correct to me. Something like:
uint32_t val = 0x2 << 8;write32(ITARGETSR + something, val);
which I don't think is supposed to work. That said, I recognize that this is a minor issue, so I won't insist.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 26 lines · Stefano Stabellini
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Julien Grall
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register field corresponding to an unimplemented interrupt is RAZ/WI."
If the user knows that an interrupt is not implemented, he may decide to
write 0 in the corresponding byte. With the current solution, the whole
write access is ignored.Quoted 8 lines
Quoted 3 lines
The solution suggested in this patch is less restrictive and will just
ignore the corresponding byte if it's 0.I think this (a 32-bit register covering both implemented and non -implemented interrupts) is a compelling reason to only ignore the specific
zero bytes and not the whole word.I agree that zero writes to unimplemented interrupts should be allowed. However allowing them for everything encourages 32-bit writes with just one byte set, the one that the OS actually wants to write. It doesn't seem correct to me. Something like:
Quoted 5 lines
uint32_tval =0x2<< 8;write32(ITARGETSR + something, val);which I don't think is supposed to work. That said, I recognize that this is a minor issue, so I won't insist.
Right.
The underlying issue here is that we can't cope with interrupts which are not routed to any CPU at all, which is the expected semantics for a write of 0 to the TARGET, right? (such interrupts essentially remain pending in the distributor).
How hard would it be to actually implement that and therefore avoid this whole issue?
Another approach btw would be to insist that nr_spis was a multiple of at least 4, then you don't have registers which are a mixture of implemented and unimplemented, which might simplify the logic.
Ian.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 33 lines · Ian Campbell
Quoted 26 lines · Stefano Stabellini
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Julien Grall
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register field corresponding to an unimplemented interrupt is RAZ/WI."
If the user knows that an interrupt is not implemented, he may decide to
write 0 in the corresponding byte. With the current solution, the whole
write access is ignored.Quoted 8 lines
Quoted 3 lines
The solution suggested in this patch is less restrictive and will just
ignore the corresponding byte if it's 0.I think this (a 32-bit register covering both implemented and non -implemented interrupts) is a compelling reason to only ignore the specific
zero bytes and not the whole word.I agree that zero writes to unimplemented interrupts should be allowed. However allowing them for everything encourages 32-bit writes with just one byte set, the one that the OS actually wants to write. It doesn't seem correct to me. Something like:
Quoted 5 lines
uint32_tval =0x2<< 8;write32(ITARGETSR + something, val);which I don't think is supposed to work. That said, I recognize that this is a minor issue, so I won't insist.
Quoted 6 lines
Right.
The underlying issue here is that we can't cope with interrupts which are not routed to any CPU at all, which is the expected semantics for a write of 0 to the TARGET, right? (such interrupts essentially remain pending in the distributor).
Unfortunately the spec is not clear about what is the expected behaviour in this case. I read it as "zero is not an allowed value".
Quoted 6 lines
How hard would it be to actually implement that and therefore avoid this whole issue?
Another approach btw would be to insist that
nr_spiswas a multiple of at least 4, then you don't have registers which are a mixture of implemented and unimplemented, which might simplify the logic.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
In reply to Ian CampbellQuoted 35 lines · Ian Campbell
Quoted 26 lines · Stefano Stabellini
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Julien Grall
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register field corresponding to an unimplemented interrupt is RAZ/WI."
If the user knows that an interrupt is not implemented, he may decide to
write 0 in the corresponding byte. With the current solution, the whole
write access is ignored.Quoted 8 lines
Quoted 3 lines
The solution suggested in this patch is less restrictive and will just
ignore the corresponding byte if it's 0.I think this (a 32-bit register covering both implemented and non -implemented interrupts) is a compelling reason to only ignore the specific
zero bytes and not the whole word.I agree that zero writes to unimplemented interrupts should be allowed. However allowing them for everything encourages 32-bit writes with just one byte set, the one that the OS actually wants to write. It doesn't seem correct to me. Something like:
Quoted 5 lines
uint32_tval =0x2<< 8;write32(ITARGETSR + something, val);which I don't think is supposed to work. That said, I recognize that this is a minor issue, so I won't insist.
Right.
Quoted 7 lines
The underlying issue here is that we can't cope with interrupts which are not routed to any CPU at all, which is the expected semantics for a write of 0 to the TARGET, right? (such interrupts essentially remain pending in the distributor).
How hard would it be to actually implement that and therefore avoid this whole issue?
It will take sometime to figure all the place which take a vcpu and expect it valid and fix it.
While this should be done at some point to respect the GICv3 and GICv2 spec, I think the correct support of 0 byte in GICD_ITARGETSR is not that important because it likely would hit people trying to disable an interrupt via GICD_ITARGETSR rather than properly using GICD_ICENABLER register to disable it.
I agree that this patch is by side effect moving from a wrong behavior to another wrong behavior (though slightly less). Although, I don't want to fix it properly in this series because I can't fix everything in a single series. The main purpose here is to fix access size to emulated register. This has to be fixed now as it prevents real guest to properly boot on Xen.
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
Quoted 3 lines
Another approach btw would be to insist that
nr_spiswas a multiple of at least 4, then you don't have registers which are a mixture of implemented and unimplemented, which might simplify the logic.
GICD_TYPER.ITLines is always a multiple of 32 (and therefore 4). Although, this is only representing the number of SPIs supported by the Distributor.
Some of them may not be wired and any write to the corresponding byte should be ignored.
Those interrupt can be detected using the d->arch.vgic.allocated_irqs bitmap.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 55 lines · Julien Grall
Quoted 47 lines · Ian Campbell
Quoted 30 lines · Stefano Stabellini
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Julien Grall
Furthermore, based on the spec (4.3.12 in IHI 0048B.b): "A register
field corresponding to an unimplemented interrupt is RAZ/WI."If the user knows that an interrupt is not implemented, he may decide
to
write 0 in the corresponding byte. With the current solution, the whole
write access is ignored.Quoted 8 lines
Quoted 3 lines
The solution suggested in this patch is less restrictive and will just
ignore the corresponding byte if it's 0.I think this (a 32-bit register covering both implemented and non -implemented interrupts) is a compelling reason to only ignore the specific
zero bytes and not the whole word.I agree that zero writes to unimplemented interrupts should be allowed.
However allowing them for everything encourages 32-bit writes with just
one byte set, the one that the OS actually wants to write. It doesn't seem correct to me. Something like:Quoted 5 lines
uint32_tval =0x2<< 8;write32(ITARGETSR + something, val);which I don't think is supposed to work. That said, I recognize that this is a minor issue, so I won't insist.
Right.
The underlying issue here is that we can't cope with interrupts which are
not routed to any CPU at all, which is the expected semantics for a write
of 0 to the TARGET, right? (such interrupts essentially remain pending in
the distributor).Quoted 3 lines
How hard would it be to actually implement that and therefore avoid this
whole issue?It will take sometime to figure all the place which take a vcpu and expect it valid and fix it.
Quoted 8 lines
While this should be done at some point to respect the GICv3 and GICv2 spec, I think the correct support of 0 byte in
GICD_ITARGETSRis not that important because it likely would hit people trying to disable an interrupt viaGICD_ITARGETSRrather than properly usingGICD_ICENABLERregister to disable it.I agree that this patch is by side effect moving from a wrong behavior to another wrong behavior (though slightly less).
Right.
Quoted 5 lines
Although, I don't want
to fix it properly in this series because I can't fix everything in a single series. The main purpose here is to fix access size to emulated register. This has to be fixed now as it prevents real guest to properly boot on Xen.
This is fair enough.
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
Ian.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 8 lines · Ian Campbell
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
It's what I understand too. I will a resend a new version tomorrow.
Quoted 3 lines
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
I'm thinking to split this patch in two:
- One which will turn the current ITARGETSR emulation in a function
with the change of behavior when writing zero to a target.
- The other to optimize the way we store the target.
This will keep the second patch nearly mechanical and avoid to change multiple behavior within the same patch.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 16 lines · Julien Grall
Quoted 8 lines · Ian Campbell
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
It's what I understand too. I will a resend a new version tomorrow.
Quoted 3 lines
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
Quoted 7 lines
I'm thinking to split this patch in two:
- One which will turn the current ITARGETSR emulation in a function
with the change of behavior when writing zero to a target.
- The other to optimize the way we store the target.This will keep the second patch nearly mechanical and avoid to change multiple behavior within the same patch.
While looking to split the patch in two part I've noticed another error in the current emulation of ITARGETSR.
For a byte access, the byte will always be in r[0:7] of the register. Although we are assuming that if the guest is writing to byte N (0 <= N < 3), the byte will be in r[N * 8: ((N + 1)* 8) - 1]. Therefore any guest using byte access won't be able to change the target:
target = (target << (8 * (gicd_reg & 0x3)));
target &= r;
I plan to fix it in patch #1 and request a backport for Xen 4.6 and Xen 4.5. I can do a separate patch if we don't want the cleanup. Note that the second patch will be a requirement to fix 32-bit access to 64-bit register.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 2 lines · Julien Grall
I plan to fix it in patch #1 and request a backport for Xen 4.6 and Xen 4.5. I can do a separate patch if we don't want the cleanup.
I'm not quite sure what you are proposing but please put logical changes and cleanups into separate patches and we will evaluate them for backport individually (taking dependencies into account too).
Ian.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
In reply to Ian CampbellQuoted 6 lines · Ian Campbell
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
Quoted 6 lines
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
OK.
BTW it would be interesting to see how real hardware behaves in this regard. I seem to recall that X-Gene was ignoring 0 writes too.
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · Ian Campbell
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
Quoted 8 lines
Quoted 3 lines
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
OK.
BTW it would be interesting to see how real hardware behaves in this regard. I seem to recall that X-Gene was ignoring 0 writes too.
What do you mean by 0 writes? Is it the write ignored if one byte is 0?
Although, it's really depend if you try on a target register where all the byte correspond to an implemented field or not.
Based on the spec (4.3.12 ARM IHI 0048B.b), a field corresponding to an interrupt not implemented (i.e not wired) is RAZ/WI.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 15 lines · Julien Grall
Quoted 14 lines · Stefano Stabellini
Quoted 12 lines · Ian Campbell
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
Quoted 6 lines
Quoted 4 lines
OK.
BTW it would be interesting to see how real hardware behaves in this regard. I seem to recall that X-Gene was ignoring 0 writes too.
What do you mean by 0 writes? Is it the write ignored if one byte is 0?
Yes, for either 32bit or 8bit writes.
Quoted 2 lines
Although, it's really depend if you try on a target register where all the byte correspond to an implemented field or not.
I am talking about implemented fields
Re: [PATCH v3 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Quoted 16 lines · Stefano Stabellini
Quoted 15 lines · Julien Grall
Quoted 14 lines · Stefano Stabellini
Quoted 12 lines · Ian Campbell
Quoted 5 lines
If the concern is the behavior is changed, I'm happy to rework this code to keep exactly the same behavior. I.e any 32-bit write containing a 0 byte will be ignored. This is not optimal but at least I'm not opening the pandora box of fixing every single error in the code touch by this series.
I'm okay with the new behaviour, I think Stefano was willing to tolerate it (based on <[email protected]>).
So if we aren't going to fix it to DTRT WRT writing zero to a target then I think we can go with the current variant and not change to ignoring any word with a zero byte in it.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
OK.
BTW it would be interesting to see how real hardware behaves in this regard. I seem to recall that X-Gene was ignoring 0 writes too.
What do you mean by 0 writes? Is it the write ignored if one byte is 0?
Yes, for either 32bit or 8bit writes.
I just gave a try on X-gene and any write is store even if it contains a 0 byte:
(XEN) ITARGET56 = 0x1010101
(XEN) w 0x2020200 r 0x2020200 (XEN) w 0x4040004 r 0x4040004 (XEN) w 0x8000808 r 0x8000808 (XEN) w 0x101010 r 0x101010
xen/arch/arm/gic-v2.c +26 -0
@@ -279,6 +279,32 @@ static void __init gicv2_dist_init(void)for ( i =32 ; i < nr_lines; i +=4 )writel_gicd (cpumask,GICD_ITARGETSR + (i /4 ) *4 ); +for ( i =32 ; i < nr_lines; i +=4 ) + { +int n = i /4 ; +int j =0 ; +unsigned int reg =GICD_ITARGETSR + (i /4 ) *4 ; + +printk ("ITARGET%u = 0x%x\n" , n,readl_gicd (reg)); + +for ( j =0 ; j <4 ; j++ ) + { +uint32_t tmp =1 << (j +1 ); + + tmp |= tmp <<8 ; + tmp |= tmp <<16 ; + +/* Mask the field j */ + tmp &= ~((0xff ) << (j *8 )); + +writel_gicd (tmp, reg); + +printk ("\t w 0x%x r 0x%x\n" , tmp,readl_gicd (reg)); + } + } + +while (1 ); +/* Default priority for global interrupts */ for ( i =32 ; i < nr_lines; i +=4 ) writel_gicd(GIC_PRI_IRQ << 24 | GIC_PRI_IRQ << 16 |
Regards,
Signature · 1 line
Julien Grall
PATCH v3 8/9 xen/arm: vgic: Introduce helpers to extract/update/clear/set vGIC register ...
In reply to Julien Gralland use them in the vGIC emulation.
The GIC registers may support different access sizes. Rather than open coding the access for every registers, provide a set of helpers to access them.
The caller will have to call vgic_regN_* where N is the size of the emulated registers.
The new helpers supports any access size and expect the caller to validate the access size supported by the emulated registers.
Finally, take the opportunity to fix the coding style in section we are modifying.
---
Changes in v3:
- Add Ian's acked-by
Changes in v2:
- Rename read/write helpers to extract/update
- Add a 's' to clearbit/setbit because we update multiple bits
Changes in v1:
- Make use of the new helpers in the vGICv2 code
- Drop vgic_byte_*
- Use unsigned long rather than uint64_t to optimize the code on ARM. (~about 40% less instruction per helpers).
--- xen/arch/arm/vgic-v2.c | 89 +++++++++++++++++++++------------- xen/arch/arm/vgic-v3.c | 116 ++++++++++++++++++++++++++++++--------------- xen/include/asm-arm/vgic.h | 111 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 235 insertions(+), 81 deletions(-)
xen/arch/arm/vgic-v2.c +56 -33
@@ -156,24 +156,31 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info,case GICD_CTLR :if ( dabt.size !=DABT_WORD ) goto bad_width;vgic_lock (v); - *r = v->domain->arch.vgic.ctlr; + *r =vgic_reg32_extract (v->domain->arch.vgic.ctlr, info);vgic_unlock (v);return 1 ;case GICD_TYPER : + { +uint32_t typer; +if ( dabt.size !=DABT_WORD ) goto bad_width;/* No secure world support for guests. */ vgic_lock (v); - *r = ( ((v->domain->max_vcpus -1 ) <<GICD_TYPE_CPUS_SHIFT ) ) + typer = ((v->domain->max_vcpus -1 ) <<GICD_TYPE_CPUS_SHIFT ) |DIV_ROUND_UP (v->domain->arch.vgic.nr_spis,32 );vgic_unlock (v); + + *r =vgic_reg32_extract (typer, info); +return 1 ; + }case GICD_IIDR :if ( dabt.size !=DABT_WORD ) goto bad_width;/* * XXX Do we need a JEP106 manufacturer ID? * Just use the physical h/w value for now */ - *r =0x0000043b ; + *r =vgic_reg32_extract (0x0000043b , info);return 1 ;/* Implementation defined -- read as zero */
@@ -189,7 +196,7 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info, rank =vgic_rank_offset (v,1 , gicd_reg -GICD_ISENABLER ,DABT_WORD );if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->ienable; + *r =vgic_reg32_extract (rank->ienable, info);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -198,7 +205,7 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info, rank =vgic_rank_offset (v,1 , gicd_reg -GICD_ICENABLER ,DABT_WORD );if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->ienable; + *r =vgic_reg32_extract (rank->ienable, info);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -213,37 +220,53 @@ static int vgic_v2_distr_mmio_read(struct vcpu *v, mmio_info_t *info, goto read_as_zero; case GICD_ITARGETSR ... GICD_ITARGETSRN: + { +uint32_t itargetsr; +if ( dabt.size !=DABT_BYTE && dabt.size !=DABT_WORD ) goto bad_width; rank =vgic_rank_offset (v,8 , gicd_reg -GICD_ITARGETSR ,DABT_WORD );if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r =vgic_fetch_itargetsr (rank, gicd_reg -GICD_ITARGETSR ); -if ( dabt.size ==DABT_BYTE ) - *r =vgic_byte_read (*r, gicd_reg); + itargetsr =vgic_fetch_itargetsr (rank, gicd_reg -GICD_ITARGETSR );vgic_unlock_rank (v, rank, flags); + *r =vgic_reg32_extract (itargetsr, info); +return 1 ; + } case GICD_IPRIORITYR ... GICD_IPRIORITYRN: + { +uint32_t ipriorityr; +if ( dabt.size !=DABT_BYTE && dabt.size !=DABT_WORD ) goto bad_width; rank =vgic_rank_offset (v,8 , gicd_reg -GICD_IPRIORITYR ,DABT_WORD ); -if ( rank ==NULL ) goto read_as_zero; +if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->ipriorityr[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR , -DABT_WORD )]; -if ( dabt.size ==DABT_BYTE ) - *r =vgic_byte_read (*r, gicd_reg); + ipriorityr = rank->ipriorityr[REG_RANK_INDEX (8 , + gicd_reg -GICD_IPRIORITYR , +DABT_WORD )];vgic_unlock_rank (v, rank, flags); + *r =vgic_reg32_extract (ipriorityr, info); +return 1 ; + } case GICD_ICFGR ... GICD_ICFGRN: + { +uint32_t icfgr; +if ( dabt.size !=DABT_WORD ) goto bad_width; rank =vgic_rank_offset (v,2 , gicd_reg -GICD_ICFGR ,DABT_WORD );if ( rank ==NULL ) goto read_as_zero;vgic_lock_rank (v, rank, flags); - *r = rank->icfg[REG_RANK_INDEX (2 , gicd_reg -GICD_ICFGR ,DABT_WORD )]; + icfgr = rank->icfg[REG_RANK_INDEX (2 , gicd_reg -GICD_ICFGR ,DABT_WORD )];vgic_unlock_rank (v, rank, flags); + + *r =vgic_reg32_extract (icfgr, info); +return 1 ; + } case GICD_NSACR ... GICD_NSACRN:/* We do not implement security extensions for guests, read zero */
@@ -353,7 +376,8 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,if ( dabt.size !=DABT_WORD ) goto bad_width;/* Ignore all but the enable bit */ vgic_lock (v); - v->domain->arch.vgic.ctlr = r &GICD_CTL_ENABLE ; +vgic_reg32_update (&v->domain->arch.vgic.ctlr, r, info); + v->domain->arch.vgic.ctlr &=GICD_CTL_ENABLE ;vgic_unlock (v);return 1 ;
@@ -377,8 +401,8 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags); tr = rank->ienable; - rank->ienable |= r; -vgic_enable_irqs (v, r & (~tr), rank->index); +vgic_reg32_setbits (&rank->ienable, r, info); +vgic_enable_irqs (v, (rank->ienable) & (~tr), rank->index);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -388,8 +412,8 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags); tr = rank->ienable; - rank->ienable &= ~r; -vgic_disable_irqs (v, r & tr, rank->index); +vgic_reg32_clearbits (&rank->ienable, r, info); +vgic_disable_irqs (v, (~rank->ienable) & tr, rank->index);vgic_unlock_rank (v, rank, flags);return 1 ;
@@ -433,13 +457,8 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info, rank =vgic_rank_offset (v,8 , gicd_reg -GICD_ITARGETSR ,DABT_WORD );if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags); -if ( dabt.size ==DABT_WORD ) - itargetsr = r; -else - { - itargetsr =vgic_fetch_itargetsr (rank, gicd_reg -GICD_ITARGETSR ); -vgic_byte_write (&itargetsr, r, gicd_reg); - } + itargetsr =vgic_fetch_itargetsr (rank, gicd_reg -GICD_ITARGETSR ); +vgic_reg32_update (&itargetsr, r, info);vgic_store_itargetsr (v->domain, rank, gicd_reg -GICD_ITARGETSR , itargetsr);vgic_unlock_rank (v, rank, flags);
@@ -447,18 +466,20 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info, } case GICD_IPRIORITYR ... GICD_IPRIORITYRN: + { +uint32_t *ipriorityr; +if ( dabt.size !=DABT_BYTE && dabt.size !=DABT_WORD ) goto bad_width; rank =vgic_rank_offset (v,8 , gicd_reg -GICD_IPRIORITYR ,DABT_WORD );if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags); -if ( dabt.size ==DABT_WORD ) - rank->ipriorityr[REG_RANK_INDEX (8 , gicd_reg -GICD_IPRIORITYR , -DABT_WORD )] = r; -else -vgic_byte_write (&rank->ipriorityr[REG_RANK_INDEX (8 , - gicd_reg -GICD_IPRIORITYR ,DABT_WORD )], r, gicd_reg); + ipriorityr = &rank->ipriorityr[REG_RANK_INDEX (8 , + gicd_reg -GICD_IPRIORITYR , +DABT_WORD )]; +vgic_reg32_update (ipriorityr, r, info);vgic_unlock_rank (v, rank, flags);return 1 ; + }case GICD_ICFGR :/* SGIs */ goto write_ignore_32;
@@ -470,7 +491,9 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info, rank =vgic_rank_offset (v,2 , gicd_reg -GICD_ICFGR ,DABT_WORD );if ( rank ==NULL ) goto write_ignore;vgic_lock_rank (v, rank, flags); - rank->icfg[REG_RANK_INDEX (2 , gicd_reg -GICD_ICFGR ,DABT_WORD )] = r; +vgic_reg32_update (&rank->icfg[REG_RANK_INDEX (2 , gicd_reg -GICD_ICFGR , +DABT_WORD )], + r, info);vgic_unlock_rank (v, rank, flags);return 1 ;
xen/arch/arm/vgic-v3.c +78 -38
294 lines not on this page · raw message
xen/include/asm-arm/vgic.h +101 -10
133 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 9/9 xen/arm: vgic-v3: Support 32-bit access for 64-bit registers
In reply to Julien GrallBased on 8.1.3 (IHI 0069A), unless stated otherwise, the 64-bit registers supports both 32-bit and 64-bits access.
All the registers we properly emulate (i.e not RAZ/WI) supports 32-bit access.
For RAZ/WI, it's also seems to be the case but I'm not 100% sure. Anyway, emulating 32-bit access for them doesn't hurt. Note that we would need some extra care when they will be implemented (for instance GICR_PROPBASER).
---
This is technically fixing boot of FreeBSD ARM64 guest with GICv3.
AFAICT, Linux is not using 32-bit access in the GICv3 code expect for the ITS (which we don't support yet).
So this patch is a good candidate for Xen 4.6.1. Although this patch is heavily depend on previous patches. It may be possible to shuffle and move the "opmitization" patches towards the end. I haven't yet done that because I feel this series makes more sense in the current order.
Also, I haven't move vgic_reg64_check_access in vgic.h because there is no usage in this series outside of vgic-v3.c and the helpers is GICv3 oriented.
Changes in v2:
- Add Ian's acked-by
Changes in v1:
- Support 32bit access on the most significant word of GICR_TYPER
--- xen/arch/arm/vgic-v3.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
xen/arch/arm/vgic-v3.c +17 -7
@@ -157,6 +157,15 @@ static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank, rank->vcpu[offset] = new_vcpu->vcpu_id; } +static inline bool vgic_reg64_check_access (struct hsr_dabt dabt) +{ +/* +* 64 bits registers can be accessible using 32-bit and 64-bit unless +* stated otherwise (See 8.1.3 ARM IHI 0069A). +*/ +return ( dabt.size ==DABT_DOUBLE_WORD || dabt.size ==DABT_WORD ); +} +static int __vgic_v3_rdistr_rd_mmio_read (struct vcpu *v,mmio_info_t *info,uint32_t gicr_reg,register_t *r)
@@ -173,10 +182,11 @@ static int __vgic_v3_rdistr_rd_mmio_read(struct vcpu *v, mmio_info_t *info, *r =vgic_reg32_extract (GICV3_GICR_IIDR_VAL , info);return 1 ;case GICR_TYPER : +case GICR_TYPER +4 : {uint64_t typer, aff; -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if ( !vgic_reg64_check_access (dabt) ) goto bad_width;/* TBD: Update processor id in [23:8] when ITS support is added */ aff = (MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 3) << 56 | MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 2) << 48 |
@@ -262,7 +272,7 @@ bad_width:return 0 ; read_as_zero_64: -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if ( !vgic_reg64_check_access (dabt) ) goto bad_width; *r =0 ;return 1 ;
@@ -338,7 +348,7 @@ bad_width:return 0 ; write_ignore_64: -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if (vgic_reg64_check_access (dabt) ) goto bad_width;return 1 ; write_ignore_32:
@@ -803,7 +813,7 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info, {uint64_t irouter; -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if ( !vgic_reg64_check_access (dabt) ) goto bad_width; rank =vgic_rank_offset (v,64 , gicd_reg -GICD_IROUTER ,DABT_DOUBLE_WORD );if ( rank ==NULL ) goto read_as_zero;
@@ -878,7 +888,7 @@ bad_width:return 0 ; read_as_zero_64: -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if (vgic_reg64_check_access (dabt) ) goto bad_width; *r =0 ;return 1 ;
@@ -964,7 +974,7 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info, {uint64_t irouter; -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if ( !vgic_reg64_check_access (dabt) ) goto bad_width; rank =vgic_rank_offset (v,64 , gicd_reg -GICD_IROUTER ,DABT_DOUBLE_WORD );if ( rank ==NULL ) goto write_ignore;
@@ -1023,7 +1033,7 @@ write_ignore_32:return 1 ; write_ignore_64: -if ( dabt.size !=DABT_DOUBLE_WORD ) goto bad_width; +if (vgic_reg64_check_access (dabt) ) goto bad_width;return 1 ; write_ignore:
Signature · 1 line
2.1.4
Hi Ian,
It looks like there is only comment on patch #7. Would it be possible to apply #1-#6? I will resend the last 3 patches after I agree with Stefano about the chosen behavior in #7.
Regards,
Quoted 40 lines · Julien Grall
Hi all,
This series aims to fixc the 32-bit access on 64-bit register. Some guest OS such as FreeBSD and Linux (only in ITS) use 32-bit access and will crash at boot time.
I took the opportunity to go further and optimize the way Xen is storing registers such as
GICD_IPRIORITYR,GICD_ITARGETSRandGICD_IROUTER.For all changes see in each patch.
A branch has been pushed based on the latest staging:
git://xenbits.xen.org/people/julieng/xen-unstable.gitbranch gicv3-32bit-v2Julien Grall (9):
xen/arm: io: removemmio_check_ttypedef
xen/arm: io: Extend write/read handler to pass the register in
parameter
xen/arm: io: Support sign-extension for every read access xen/arm: vgic: ctlr stores a 32-bit hardware register so useuint32_txen/arm: vgic: Optimize the way to storeGICD_IPRIORITYRin the rank xen/arm: vgic: Introduce a new field to store the rank index and use
it
xen/arm: vgic: Optimize the way to store the target vCPU in the rank xen/arm: vgic: Introduce helpers to extract/update/clear/set vGIC
register ...
xen/arm: vgic-v3: Support 32-bit access for 64-bit registersxen/arch/arm/io.c | 34 ++++- xen/arch/arm/vgic-v2.c | 308 +++++++++++++++++++------------------ xen/arch/arm/vgic-v3.c | 353 +++++++++++++++++++++++-------------------- xen/arch/arm/vgic.c | 70 +++++++-- xen/arch/arm/vuart.c | 20 ++- xen/include/asm-arm/domain.h | 2 +- xen/include/asm-arm/mmio.h | 7 +- xen/include/asm-arm/vgic.h | 151 ++++++++++++++---- 8 files changed, 582 insertions(+), 363 deletions(-)
Signature · 1 line
Julien Grall
Quoted 4 lines · Julien Grall
Hi Ian,
It looks like there is only comment on patch #7. Would it be possible to apply #1-#6?
Done.