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,
|
||||
"Maximum number of PE. This is affecting the maximum number of "
|
||||
"redistributors")
|
||||
|
||||
gicv4 = Param.Bool(True, "GICv4 extension available")
|
||||
|
||||
@@ -48,12 +48,6 @@ Gicv3::Gicv3(const Params * p)
|
||||
void
|
||||
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);
|
||||
redistributors.resize(sys->numContexts(), nullptr);
|
||||
cpuInterfaces.resize(sys->numContexts(), nullptr);
|
||||
@@ -68,12 +62,23 @@ Gicv3::init()
|
||||
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();
|
||||
|
||||
for (int i = 0; i < sys->numContexts(); i++) {
|
||||
redistributors[i]->init();
|
||||
cpuInterfaces[i]->init();
|
||||
}
|
||||
|
||||
BaseGic::init();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -107,8 +112,8 @@ Gicv3::read(PacketPtr pkt)
|
||||
} else if (redistRange.contains(addr)) {
|
||||
Addr daddr = addr - redistRange.start();
|
||||
uint32_t redistributor_id =
|
||||
daddr / Gicv3Redistributor::ADDR_RANGE_SIZE;
|
||||
daddr = daddr % Gicv3Redistributor::ADDR_RANGE_SIZE;
|
||||
daddr / redistSize;
|
||||
daddr = daddr % redistSize;
|
||||
panic_if(redistributor_id >= redistributors.size(),
|
||||
"Invalid redistributor_id!");
|
||||
panic_if(!redistributors[redistributor_id], "Redistributor is null!");
|
||||
@@ -148,8 +153,8 @@ Gicv3::write(PacketPtr pkt)
|
||||
} else if (redistRange.contains(addr)) {
|
||||
Addr daddr = addr - redistRange.start();
|
||||
uint32_t redistributor_id =
|
||||
daddr / Gicv3Redistributor::ADDR_RANGE_SIZE;
|
||||
daddr = daddr % Gicv3Redistributor::ADDR_RANGE_SIZE;
|
||||
daddr / redistSize;
|
||||
daddr = daddr % redistSize;
|
||||
panic_if(redistributor_id >= redistributors.size(),
|
||||
"Invalid redistributor_id!");
|
||||
panic_if(!redistributors[redistributor_id], "Redistributor is null!");
|
||||
|
||||
@@ -42,6 +42,7 @@ class Gicv3 : public BaseGic
|
||||
{
|
||||
protected:
|
||||
friend class Gicv3CPUInterface;
|
||||
friend class Gicv3Redistributor;
|
||||
|
||||
typedef Gicv3Params Params;
|
||||
Gicv3Distributor * distributor;
|
||||
@@ -50,6 +51,7 @@ class Gicv3 : public BaseGic
|
||||
AddrRange distRange;
|
||||
AddrRange redistRange;
|
||||
AddrRangeList addrRanges;
|
||||
uint64_t redistSize;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ Gicv3Redistributor::Gicv3Redistributor(Gicv3 * gic, uint32_t cpu_id)
|
||||
irqPriority(Gicv3::SGI_MAX + Gicv3::PPI_MAX),
|
||||
irqConfig(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
|
||||
* loader code.
|
||||
*/
|
||||
static const uint32_t ADDR_RANGE_SIZE = 0x40000;
|
||||
const uint32_t addrRangeSize;
|
||||
|
||||
static const uint32_t SMALLEST_LPI_ID = 8192;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user