Conversation
| uint32_t res4; /* 0x0054 */ | ||
| uint32_t clrspi_sr; /* 0x0058 */ | ||
| uint32_t res5[9]; /* [0x005C, 0x0080) */ | ||
| uint32_t irq_group0[CONFIG_MAX_NUM_NODES]; /* [0x080, 0x84) */ |
There was a problem hiding this comment.
This copies the same sloppiness than in the GICv2. We are not adding 1 filed here, but multiple in case there are multiple codes. So the offsets mentioned in the comments are not really right. It does not matter practically, but it might be a bit misleading of one really does offset calculation here - they wont always work. But that's a separate thing to clean up one day
There was a problem hiding this comment.
This code was originally written several years ago. I've tried to fold through the updates to the original files as I've rebased it, but some things may have been missed. Thanks for pointing out any changes that were missed.
|
In some commit message you say I wonder, is this a toolin quirk or is Co-Author missing? |
I'm not sure what you mean. |
|
Could you split this up and make the fixes a PR to merge first (remove unused function, vgic cleanups - calloc, use correct index in VGIC fault) before the refactoring and adding GICv3? |
Ah ok, I did not see that you kept the original commits. |
| assert(!"Unable to calloc memory for VGIC"); | ||
| return -1; | ||
| } | ||
| vgic_virq_init(vgic); |
There was a problem hiding this comment.
Agree, I found the same thing in one of my dev branches.
| #define IRQ_IDX(irq) ((irq) / 32) | ||
| #define IRQ_BIT(irq) (1U << ((irq) % 32)) | ||
|
|
||
| extern const struct vgic_dist_device dev_vgic_dist; |
There was a problem hiding this comment.
if we put this here, for consistency we should also include a header that has the type definition.
There was a problem hiding this comment.
This doesn't need to be here anyway.
| return is_spi_enabled(gic_dist, irq); | ||
| } | ||
|
|
||
| static inline void set_sgi_ppi_active(struct gic_dist_map *gic_dist, int irq, bool set_active, int vcpu_id) |
There was a problem hiding this comment.
Yes, this seems unused, we are only accessing the field directly. I was a assuming this was kept in case a VMM needs to be able to manage something here. But activating interrupts unter the hood of a VM seems an odd thing to do.
I have created #65 for this. |
3e88b18 to
94d29d5
Compare
f785b5f to
615fdab
Compare
| return -1; | ||
| } | ||
|
|
||
| registers->dist = calloc(1, sizeof(struct gic_dist_map)); |
There was a problem hiding this comment.
I wonder, why do we allocate dist and redist separately and not make this a fixed part of vgic_reg_t, so we only have to allocate things once? That saves us 2 calls to calloc() and there would not be much difference because neither of these structs gets a special 4K alignment anyway.
f01cdbc to
051079c
Compare
There are a few subtle differences in the gic distributor between gicv2 and v3. Refactor these into the gicv2 header to prepare for a gicv3 implementation. Co-authored-by: Kent McLeod <kent@kry10.com> Signed-off-by: Kent McLeod <kent@kry10.com>
This commit adds support for emulating the gicv3. Work for this commit was pulled from prototype works by the following authors: Co-authored-by: Kent McLeod <kent@kry10.com> Co-authored-by: Yanyan Shen <yanyan.shen@data61.csiro.au> Co-authored-by: Chris Guikema <chris.guikema@dornerworks.com> Signed-off-by: Kent McLeod <kent@kry10.com>
|
How is this going? Are you @kent-mcleod still working on it? |
051079c to
aad2643
Compare
Most of the refactoring was merged in #68. |
This PR adds an emulated GIC500 (GICv3) to libsel4vmm as a virtual device.
This branch is based off of an earlier PR, #8, by @pingerino which already included commits pulled together from a couple authors.
This has been tested with the imx8mm-evk platform to run a Linux guest VM with several pass-through peripherals.
Marking the PR as a draft for now, as some minor cleanup is still needed.
Some imx8mm changes: kent-mcleod@bd4b06c