Page MenuHomeFreeBSD

D62227.1796274244.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62227.1796274244.diff

diff --git a/sys/arm64/vmm/io/vgic_v5.c b/sys/arm64/vmm/io/vgic_v5.c
--- a/sys/arm64/vmm/io/vgic_v5.c
+++ b/sys/arm64/vmm/io/vgic_v5.c
@@ -292,8 +292,6 @@
reg, size, rval, NULL))
return (0);
- panic("%s: TODO %lx\n", __func__, reg);
-
/* Other register addresses are RAZ */
*rval = 0;
@@ -330,8 +328,6 @@
reg, size, wval, NULL))
return (0);
- panic("%s: TODO %lx\n", __func__, reg);
-
/* Other register addresses are WI */
return (0);
}
@@ -511,13 +507,18 @@
{
struct hypctx *target_hypctx;
struct vgic_v5 *vgic;
+ int pe_selr;
vgic = &hypctx->hyp->vgic->v5;
- if (vgic->irs_pe_selr < vgic->max_cpu_count) {
- target_hypctx = hypctx->hyp->ctx[vgic->irs_pe_selr];
- *rval = target_hypctx->vgic_cpu->v5.dps ? IRS_PE_CR0_DPS : 0;
- } else
- *rval = 0;
+ pe_selr = atomic_load_int(&vgic->irs_pe_selr);
+
+ *rval = 0;
+
+ if (pe_selr < vgic->max_cpu_count) {
+ target_hypctx = hypctx->hyp->ctx[pe_selr];
+ if (target_hypctx && target_hypctx->vgic_cpu->v5.dps)
+ *rval = IRS_PE_CR0_DPS;
+ }
}
void
@@ -526,11 +527,15 @@
{
struct hypctx *target_hypctx;
struct vgic_v5 *vgic;
+ int pe_selr;
vgic = &hypctx->hyp->vgic->v5;
- if (vgic->irs_pe_selr < vgic->max_cpu_count) {
- target_hypctx = hypctx->hyp->ctx[vgic->irs_pe_selr];
- target_hypctx->vgic_cpu->v5.dps = wval & IRS_PE_CR0_DPS;
+ pe_selr = atomic_load_int(&vgic->irs_pe_selr);
+
+ if (pe_selr < vgic->max_cpu_count) {
+ target_hypctx = hypctx->hyp->ctx[pe_selr];
+ if (target_hypctx)
+ target_hypctx->vgic_cpu->v5.dps = wval & IRS_PE_CR0_DPS;
}
}
@@ -541,18 +546,20 @@
struct vgic_v5 *vgic;
vgic = &hypctx->hyp->vgic->v5;
- vgic->irs_pe_selr = wval & IRS_PE_SELR_IAFFID_MASK;
+ atomic_store_int(&vgic->irs_pe_selr, wval & IRS_PE_SELR_IAFFID_MASK);
}
static void
irs_pe_statusr_read(struct hypctx *hypctx, u_int reg, uint64_t *rval, void *arg)
{
struct vgic_v5 *vgic;
+ int pe_selr;
vgic = &hypctx->hyp->vgic->v5;
+ pe_selr = atomic_load_int(&vgic->irs_pe_selr);
*rval = IRS_PE_CR0_IDLE;
- if (vgic->irs_pe_selr < vgic->max_cpu_count)
+ if (pe_selr < vgic->max_cpu_count && hypctx->hyp->ctx[pe_selr] != NULL)
*rval |= IRS_PE_CR0_V;
}
@@ -583,14 +590,13 @@
val = atomic_load_64(&vgic->irs_ist_baser);
if (offset == 0) {
- /* Set the upper 32 bits */
- shift = 32;
+ /* Set the lower 32 bits */
+ shift = 0;
} else {
MPASS(offset == 4);
- shift = 0;
+ shift = 32;
}
-
mask = 0xfffffffful << shift;
nval = (wval & 0xfffffffful) << shift;
while (!atomic_fcmpset_64(&vgic->irs_ist_baser, &val,
@@ -710,6 +716,9 @@
{
device_t parent;
+ if (!hyp->vgic_attached)
+ return;
+
switch (hyp->vgic->vgic_ver) {
case 0:
/* No vgic was attached */
@@ -755,6 +764,9 @@
uint64_t reg;
u_int irq;
+ if (!hyp->vgic_attached)
+ return (ENODEV);
+
if (hyp->vgic->vgic_ver == 3) {
return (vgic_v3_inject_irq(dev, hyp, vcpuid, irqid, level));
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 3, 5:04 AM (19 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42127265
Default Alt Text
D62227.1796274244.diff (2 KB)

Event Timeline