Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152950368
D19842.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D19842.diff
View Options
Index: head/sys/arm64/arm64/gic_v3.c
===================================================================
--- head/sys/arm64/arm64/gic_v3.c
+++ head/sys/arm64/arm64/gic_v3.c
@@ -183,36 +183,44 @@
gic_r_read_4(device_t dev, bus_size_t offset)
{
struct gic_v3_softc *sc;
+ struct resource *rdist;
sc = device_get_softc(dev);
- return (bus_read_4(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset));
+ rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res;
+ return (bus_read_4(rdist, offset));
}
uint64_t
gic_r_read_8(device_t dev, bus_size_t offset)
{
struct gic_v3_softc *sc;
+ struct resource *rdist;
sc = device_get_softc(dev);
- return (bus_read_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset));
+ rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res;
+ return (bus_read_8(rdist, offset));
}
void
gic_r_write_4(device_t dev, bus_size_t offset, uint32_t val)
{
struct gic_v3_softc *sc;
+ struct resource *rdist;
sc = device_get_softc(dev);
- bus_write_4(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val);
+ rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res;
+ bus_write_4(rdist, offset, val);
}
void
gic_r_write_8(device_t dev, bus_size_t offset, uint64_t val)
{
struct gic_v3_softc *sc;
+ struct resource *rdist;
sc = device_get_softc(dev);
- bus_write_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val);
+ rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res;
+ bus_write_8(rdist, offset, val);
}
/*
@@ -384,8 +392,11 @@
return (0);
case GICV3_IVAR_REDIST_VADDR:
*result = (uintptr_t)rman_get_virtual(
- sc->gic_redists.pcpu[PCPU_GET(cpuid)]);
+ &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res);
return (0);
+ case GICV3_IVAR_REDIST:
+ *result = (uintptr_t)sc->gic_redists.pcpu[PCPU_GET(cpuid)];
+ return (0);
case GIC_IVAR_HW_REV:
KASSERT(
GICR_PIDR2_ARCH(sc->gic_pidr2) == GICR_PIDR2_ARCH_GICv3 ||
@@ -979,7 +990,7 @@
res = sc->gic_dist;
break;
case REDIST:
- res = sc->gic_redists.pcpu[cpuid];
+ res = &sc->gic_redists.pcpu[cpuid]->res;
break;
default:
KASSERT(0, ("%s: Attempt to wait for unknown RWP", __func__));
@@ -1173,7 +1184,7 @@
KASSERT(sc->gic_redists.pcpu[cpuid] != NULL,
("Invalid pointer to per-CPU redistributor"));
/* Copy res contents to its final destination */
- *sc->gic_redists.pcpu[cpuid] = r_res;
+ sc->gic_redists.pcpu[cpuid]->res = r_res;
if (bootverbose) {
device_printf(sc->dev,
"CPU%u Re-Distributor has been found\n",
Index: head/sys/arm64/arm64/gic_v3_var.h
===================================================================
--- head/sys/arm64/arm64/gic_v3_var.h
+++ head/sys/arm64/arm64/gic_v3_var.h
@@ -40,10 +40,9 @@
struct gic_v3_irqsrc;
-struct redist_lpis {
- vm_offset_t conf_base;
- vm_offset_t pend_base[MAXCPU];
- uint64_t flags;
+struct redist_pcpu {
+ struct resource res;
+ vm_offset_t pend_base;
};
struct gic_redists {
@@ -55,10 +54,8 @@
struct resource ** regions;
/* Number of Re-Distributor regions */
u_int nregions;
- /* Per-CPU Re-Distributor handler */
- struct resource * pcpu[MAXCPU];
- /* LPIs data */
- struct redist_lpis lpis;
+ /* Per-CPU Re-Distributor data */
+ struct redist_pcpu *pcpu[MAXCPU];
};
struct gic_v3_softc {
@@ -97,9 +94,11 @@
/* ivars */
#define GICV3_IVAR_NIRQS 1000
#define GICV3_IVAR_REDIST_VADDR 1001
+#define GICV3_IVAR_REDIST 1002
__BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int);
__BUS_ACCESSOR(gicv3, redist_vaddr, GICV3, REDIST_VADDR, void *);
+__BUS_ACCESSOR(gicv3, redist, GICV3, REDIST, void *);
/* Device methods */
int gic_v3_attach(device_t dev);
@@ -131,7 +130,7 @@
u_int cpu = PCPU_GET(cpuid); \
\
bus_read_##len( \
- sc->gic_redists.pcpu[cpu], \
+ &sc->gic_redists.pcpu[cpu]->res, \
reg); \
})
@@ -140,7 +139,7 @@
u_int cpu = PCPU_GET(cpuid); \
\
bus_write_##len( \
- sc->gic_redists.pcpu[cpu], \
+ &sc->gic_redists.pcpu[cpu]->res, \
reg, val); \
})
Index: head/sys/arm64/arm64/gicv3_its.c
===================================================================
--- head/sys/arm64/arm64/gicv3_its.c
+++ head/sys/arm64/arm64/gicv3_its.c
@@ -577,6 +577,7 @@
static int
its_init_cpu(device_t dev, struct gicv3_its_softc *sc)
{
+ struct redist_pcpu *rpcpu;
device_t gicv3;
vm_paddr_t target;
uint64_t xbaser, tmp;
@@ -664,7 +665,8 @@
if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) {
/* This ITS wants the redistributor physical address */
- target = vtophys(gicv3_get_redist_vaddr(dev));
+ rpcpu = gicv3_get_redist(dev);
+ target = vtophys(rman_get_virtual(&rpcpu->res));
} else {
/* This ITS wants the unique processor number */
target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 6:58 AM (6 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31752156
Default Alt Text
D19842.diff (4 KB)
Attached To
Mode
D19842: gic_v3: consolidate per-cpu redistributor information
Attached
Detach File
Event Timeline
Log In to Comment