GICv3 emulation preparation PR#68
Conversation
5cea508 to
a5500a1
Compare
| virq->ack = ack_fn; | ||
| } | ||
|
|
||
| static inline struct vgic *vgic_device_get_vgic(struct vgic_dist_device *d) |
There was a problem hiding this comment.
This function does not really belong here, it would fit better in vgic_v2.c even if this duplicates code for GICv3 then. I have a branch where struct vgic_dist_device is dropped completely and this is all part of the struct vgic (see #69) then, but have to check how this would work with the GICv3 code then.
There was a problem hiding this comment.
What you say makes sense about the function staying in vgic_v2.c, I need to check with the old version whether it had it in there or whether I accidentally pulled it in during a rebase.
I'm not sure whether dropping vgic_dist_device would make the code cleaner and it'd be better to wait until v3 code is merged before we consider IMO.
There was a problem hiding this comment.
I added a new commit to address this: 0ec24c1. I think it's a bit reactive, but still reasonable to fix it this way.
| return 0; | ||
| } | ||
|
|
||
| int vm_inject_irq(vm_vcpu_t *vcpu, int irq) |
There was a problem hiding this comment.
It seem this function remains the same in GICv2 and GICv3. Thus I think it would make sense to keep thios in a common file and avoid code duplication. If there are differences in the future, we can still split this up,
| return 0; | ||
| } | ||
|
|
||
| int vm_vgic_maintenance_handler(vm_vcpu_t *vcpu) |
There was a problem hiding this comment.
Same here, this function and alsdo handle_vgic_maintenance() are the same in GICv2 and GIV3, so I'd keep this in a common file for now.
There was a problem hiding this comment.
They're slightly different since GICv3 uses group 1 while GICv2 uses group 0.
There was a problem hiding this comment.
(only handle_vgic_maintenance differs)
There was a problem hiding this comment.
True, but that could be a constant then. My main point at the moment it trying to have GICv3 support with out renaming the source file and moving code, so the change are easier to maintain.
axel-h
left a comment
There was a problem hiding this comment.
I not too happy with some things in the code, but it the greater goal is adding some GICv3 support finally, then I wont block this.
a5500a1 to
10635d1
Compare
Declare dev_vgic_dist as containing a vgic_t object, but leave the definition abstract for the implementation to define. This doesn't change much for the public API, but allows the internal implementation to assume that the field is always a vgic_t reference which it always is. Signed-off-by: Kent McLeod <kent@kry10.com>
- pull virq functionality that is not only relevant to the gicv2 into another header file, virq.h Co-authored-by: Kent McLeod <kent@kry10.com> Signed-off-by: Kent McLeod <kent@kry10.com>
Makes inlining consistent and allows header file to be included in more than one source file if necessary. Signed-off-by: Kent McLeod <kent@kry10.com>
This code is common between the gicv2 and giv3 Co-authored-by: Kent McLeod <kent@kry10.com> Signed-off-by: Kent McLeod <kent@kry10.com>
vgic.c virtualises the gicv2 Co-authored-by: Kent McLeod <kent@kry10.com> Signed-off-by: Kent McLeod <kent@kry10.com>
The incoming gic_v3 driver needs to use group 1 for interrupts it injects, while gic_v2 needs to use group 0. Signed-off-by: Kent McLeod <kent@kry10.com>
10635d1 to
15137ab
Compare
These changes are the first few commits from #58 which reorganize the vgic code to allow adding support for GICv3.
For reviewing, these changes shouldn't be changing any behavior of the current implementation and are only supposed to be moving code around with a few function prototype changes, eg
static->static inline.