dev-arm: Add GICv4 extension switch in GICv3
This is currently used only for determining which is the correct size of redistributors in memory (256KB in GICv4 and 128KB in GICv3) Change-Id: I2c07005e97167fde03548313c9927176788f31dd Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18391 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -182,3 +182,5 @@ class Gicv3(BaseGic):
|
|||||||
cpu_max = Param.Unsigned(256,
|
cpu_max = Param.Unsigned(256,
|
||||||
"Maximum number of PE. This is affecting the maximum number of "
|
"Maximum number of PE. This is affecting the maximum number of "
|
||||||
"redistributors")
|
"redistributors")
|
||||||
|
|
||||||
|
gicv4 = Param.Bool(True, "GICv4 extension available")
|
||||||
|
|||||||
@@ -48,12 +48,6 @@ Gicv3::Gicv3(const Params * p)
|
|||||||
void
|
void
|
||||||
Gicv3::init()
|
Gicv3::init()
|
||||||
{
|
{
|
||||||
distRange = RangeSize(params()->dist_addr,
|
|
||||||
Gicv3Distributor::ADDR_RANGE_SIZE - 1);
|
|
||||||
redistRange = RangeSize(params()->redist_addr,
|
|
||||||
Gicv3Redistributor::ADDR_RANGE_SIZE * sys->numContexts() - 1);
|
|
||||||
addrRanges = {distRange, redistRange};
|
|
||||||
BaseGic::init();
|
|
||||||
distributor = new Gicv3Distributor(this, params()->it_lines);
|
distributor = new Gicv3Distributor(this, params()->it_lines);
|
||||||
redistributors.resize(sys->numContexts(), nullptr);
|
redistributors.resize(sys->numContexts(), nullptr);
|
||||||
cpuInterfaces.resize(sys->numContexts(), nullptr);
|
cpuInterfaces.resize(sys->numContexts(), nullptr);
|
||||||
@@ -68,12 +62,23 @@ Gicv3::init()
|
|||||||
cpuInterfaces[i] = new Gicv3CPUInterface(this, i);
|
cpuInterfaces[i] = new Gicv3CPUInterface(this, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
distRange = RangeSize(params()->dist_addr,
|
||||||
|
Gicv3Distributor::ADDR_RANGE_SIZE - 1);
|
||||||
|
|
||||||
|
redistSize = redistributors[0]->addrRangeSize;
|
||||||
|
redistRange = RangeSize(params()->redist_addr,
|
||||||
|
redistSize * sys->numContexts() - 1);
|
||||||
|
|
||||||
|
addrRanges = {distRange, redistRange};
|
||||||
|
|
||||||
distributor->init();
|
distributor->init();
|
||||||
|
|
||||||
for (int i = 0; i < sys->numContexts(); i++) {
|
for (int i = 0; i < sys->numContexts(); i++) {
|
||||||
redistributors[i]->init();
|
redistributors[i]->init();
|
||||||
cpuInterfaces[i]->init();
|
cpuInterfaces[i]->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseGic::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -107,8 +112,8 @@ Gicv3::read(PacketPtr pkt)
|
|||||||
} else if (redistRange.contains(addr)) {
|
} else if (redistRange.contains(addr)) {
|
||||||
Addr daddr = addr - redistRange.start();
|
Addr daddr = addr - redistRange.start();
|
||||||
uint32_t redistributor_id =
|
uint32_t redistributor_id =
|
||||||
daddr / Gicv3Redistributor::ADDR_RANGE_SIZE;
|
daddr / redistSize;
|
||||||
daddr = daddr % Gicv3Redistributor::ADDR_RANGE_SIZE;
|
daddr = daddr % redistSize;
|
||||||
panic_if(redistributor_id >= redistributors.size(),
|
panic_if(redistributor_id >= redistributors.size(),
|
||||||
"Invalid redistributor_id!");
|
"Invalid redistributor_id!");
|
||||||
panic_if(!redistributors[redistributor_id], "Redistributor is null!");
|
panic_if(!redistributors[redistributor_id], "Redistributor is null!");
|
||||||
@@ -148,8 +153,8 @@ Gicv3::write(PacketPtr pkt)
|
|||||||
} else if (redistRange.contains(addr)) {
|
} else if (redistRange.contains(addr)) {
|
||||||
Addr daddr = addr - redistRange.start();
|
Addr daddr = addr - redistRange.start();
|
||||||
uint32_t redistributor_id =
|
uint32_t redistributor_id =
|
||||||
daddr / Gicv3Redistributor::ADDR_RANGE_SIZE;
|
daddr / redistSize;
|
||||||
daddr = daddr % Gicv3Redistributor::ADDR_RANGE_SIZE;
|
daddr = daddr % redistSize;
|
||||||
panic_if(redistributor_id >= redistributors.size(),
|
panic_if(redistributor_id >= redistributors.size(),
|
||||||
"Invalid redistributor_id!");
|
"Invalid redistributor_id!");
|
||||||
panic_if(!redistributors[redistributor_id], "Redistributor is null!");
|
panic_if(!redistributors[redistributor_id], "Redistributor is null!");
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class Gicv3 : public BaseGic
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
friend class Gicv3CPUInterface;
|
friend class Gicv3CPUInterface;
|
||||||
|
friend class Gicv3Redistributor;
|
||||||
|
|
||||||
typedef Gicv3Params Params;
|
typedef Gicv3Params Params;
|
||||||
Gicv3Distributor * distributor;
|
Gicv3Distributor * distributor;
|
||||||
@@ -50,6 +51,7 @@ class Gicv3 : public BaseGic
|
|||||||
AddrRange distRange;
|
AddrRange distRange;
|
||||||
AddrRange redistRange;
|
AddrRange redistRange;
|
||||||
AddrRangeList addrRanges;
|
AddrRangeList addrRanges;
|
||||||
|
uint64_t redistSize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ Gicv3Redistributor::Gicv3Redistributor(Gicv3 * gic, uint32_t cpu_id)
|
|||||||
irqPriority(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
irqPriority(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
||||||
irqConfig(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
irqConfig(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
||||||
irqGrpmod(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
irqGrpmod(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
||||||
irqNsacr(Gicv3::SGI_MAX + Gicv3::PPI_MAX)
|
irqNsacr(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
||||||
|
addrRangeSize(gic->params()->gicv4 ? 0x40000 : 0x20000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ class Gicv3Redistributor : public Serializable
|
|||||||
* Note this must match with DTB/DTS GIC node definition and boot
|
* Note this must match with DTB/DTS GIC node definition and boot
|
||||||
* loader code.
|
* loader code.
|
||||||
*/
|
*/
|
||||||
static const uint32_t ADDR_RANGE_SIZE = 0x40000;
|
const uint32_t addrRangeSize;
|
||||||
|
|
||||||
static const uint32_t SMALLEST_LPI_ID = 8192;
|
static const uint32_t SMALLEST_LPI_ID = 8192;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user