mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
arm64/gicv3: Check if the hardware supports LPIs
Some simulators have the ITS in the DTB passed to the kernel, however it is a runtime configuration option to enable it. Check the GICD_TYPER register to see if LPIs are enabled before attaching the ITS driver. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D44914
This commit is contained in:
parent
f91e9401c2
commit
4ab0f5ab3f
|
@ -494,6 +494,10 @@ gic_v3_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
|
||||||
case GICV3_IVAR_REDIST:
|
case GICV3_IVAR_REDIST:
|
||||||
*result = (uintptr_t)&sc->gic_redists.pcpu[PCPU_GET(cpuid)];
|
*result = (uintptr_t)&sc->gic_redists.pcpu[PCPU_GET(cpuid)];
|
||||||
return (0);
|
return (0);
|
||||||
|
case GICV3_IVAR_SUPPORT_LPIS:
|
||||||
|
*result =
|
||||||
|
(gic_d_read(sc, 4, GICD_TYPER) & GICD_TYPER_LPIS) != 0;
|
||||||
|
return (0);
|
||||||
case GIC_IVAR_HW_REV:
|
case GIC_IVAR_HW_REV:
|
||||||
KASSERT(
|
KASSERT(
|
||||||
GICR_PIDR2_ARCH(sc->gic_pidr2) == GICR_PIDR2_ARCH_GICv3 ||
|
GICR_PIDR2_ARCH(sc->gic_pidr2) == GICR_PIDR2_ARCH_GICv3 ||
|
||||||
|
|
|
@ -102,9 +102,11 @@ MALLOC_DECLARE(M_GIC_V3);
|
||||||
#define GICV3_IVAR_NIRQS 1000
|
#define GICV3_IVAR_NIRQS 1000
|
||||||
/* 1001 was GICV3_IVAR_REDIST_VADDR */
|
/* 1001 was GICV3_IVAR_REDIST_VADDR */
|
||||||
#define GICV3_IVAR_REDIST 1002
|
#define GICV3_IVAR_REDIST 1002
|
||||||
|
#define GICV3_IVAR_SUPPORT_LPIS 1003
|
||||||
|
|
||||||
__BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int);
|
__BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int);
|
||||||
__BUS_ACCESSOR(gicv3, redist, GICV3, REDIST, void *);
|
__BUS_ACCESSOR(gicv3, redist, GICV3, REDIST, void *);
|
||||||
|
__BUS_ACCESSOR(gicv3, support_lpis, GICV3, SUPPORT_LPIS, bool);
|
||||||
|
|
||||||
/* Device methods */
|
/* Device methods */
|
||||||
int gic_v3_attach(device_t dev);
|
int gic_v3_attach(device_t dev);
|
||||||
|
|
|
@ -2208,6 +2208,9 @@ gicv3_its_fdt_probe(device_t dev)
|
||||||
if (!ofw_bus_is_compatible(dev, "arm,gic-v3-its"))
|
if (!ofw_bus_is_compatible(dev, "arm,gic-v3-its"))
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
|
|
||||||
|
if (!gicv3_get_support_lpis(dev))
|
||||||
|
return (ENXIO);
|
||||||
|
|
||||||
device_set_desc(dev, "ARM GIC Interrupt Translation Service");
|
device_set_desc(dev, "ARM GIC Interrupt Translation Service");
|
||||||
return (BUS_PROBE_DEFAULT);
|
return (BUS_PROBE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
@ -2277,6 +2280,9 @@ gicv3_its_acpi_probe(device_t dev)
|
||||||
if (gic_get_hw_rev(dev) < 3)
|
if (gic_get_hw_rev(dev) < 3)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
|
if (!gicv3_get_support_lpis(dev))
|
||||||
|
return (ENXIO);
|
||||||
|
|
||||||
device_set_desc(dev, "ARM GIC Interrupt Translation Service");
|
device_set_desc(dev, "ARM GIC Interrupt Translation Service");
|
||||||
return (BUS_PROBE_DEFAULT);
|
return (BUS_PROBE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue