Deleted Added
sdiff udiff text old ( 14057:786dbd2c3bfc ) new ( 14227:af80b8fab43b )
full compact
1/*
2 * Copyright (c) 2019 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2018 Metempsy Technology Consulting
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright

--- 1401 unchanged lines hidden (view full) ---

1423
1424 isa->setMiscRegNoEffect(MISCREG_ICC_IGRPEN1_EL1, icc_igrpen1_el1);
1425 break;
1426 }
1427
1428 // Software Generated Interrupt Group 0 Register
1429 case MISCREG_ICC_SGI0R:
1430 case MISCREG_ICC_SGI0R_EL1:
1431 generateSGI(val, Gicv3::G0S);
1432 break;
1433
1434 // Software Generated Interrupt Group 1 Register
1435 case MISCREG_ICC_SGI1R:
1436 case MISCREG_ICC_SGI1R_EL1: {
1437 Gicv3::GroupId group = inSecureState() ? Gicv3::G1S : Gicv3::G1NS;
1438
1439 generateSGI(val, group);
1440 break;
1441 }
1442
1443 // Alias Software Generated Interrupt Group 1 Register
1444 case MISCREG_ICC_ASGI1R:
1445 case MISCREG_ICC_ASGI1R_EL1: {
1446 Gicv3::GroupId group = inSecureState() ? Gicv3::G1NS : Gicv3::G1S;
1447
1448 generateSGI(val, group);
1449 break;
1450 }
1451
1452 // System Register Enable Register EL1
1453 case MISCREG_ICC_SRE:
1454 case MISCREG_ICC_SRE_EL1:
1455 // System Register Enable Register EL2
1456 case MISCREG_ICC_HSRE:
1457 case MISCREG_ICC_SRE_EL2:

--- 296 unchanged lines hidden (view full) ---

1754 return (vapr1_count + i * 32) << (GIC_MIN_VBPR + 1);
1755 }
1756 }
1757
1758 return 0xff;
1759}
1760
1761void
1762Gicv3CPUInterface::generateSGI(RegVal val, Gicv3::GroupId group)
1763{
1764 uint8_t aff3 = bits(val, 55, 48);
1765 uint8_t aff2 = bits(val, 39, 32);
1766 uint8_t aff1 = bits(val, 23, 16);;
1767 uint16_t target_list = bits(val, 15, 0);
1768 uint32_t int_id = bits(val, 27, 24);
1769 bool irm = bits(val, 40, 40);
1770 uint8_t rs = bits(val, 47, 44);
1771
1772 bool ns = !inSecureState();
1773
1774 for (int i = 0; i < gic->getSystem()->numContexts(); i++) {
1775 Gicv3Redistributor * redistributor_i =
1776 gic->getRedistributor(i);
1777 uint32_t affinity_i = redistributor_i->getAffinity();
1778
1779 if (irm) {
1780 // Interrupts routed to all PEs in the system,
1781 // excluding "self"
1782 if (affinity_i == redistributor->getAffinity()) {
1783 continue;
1784 }
1785 } else {
1786 // Interrupts routed to the PEs specified by
1787 // Aff3.Aff2.Aff1.<target list>
1788 if ((affinity_i >> 8) !=
1789 ((aff3 << 16) | (aff2 << 8) | (aff1 << 0))) {
1790 continue;
1791 }
1792
1793 uint8_t aff0_i = bits(affinity_i, 7, 0);
1794
1795 if (!(aff0_i >= rs * 16 && aff0_i < (rs + 1) * 16 &&
1796 ((0x1 << (aff0_i - rs * 16)) & target_list))) {
1797 continue;
1798 }
1799 }
1800
1801 redistributor_i->sendSGI(int_id, group, ns);
1802 }
1803}
1804
1805void
1806Gicv3CPUInterface::activateIRQ(uint32_t int_id, Gicv3::GroupId group)
1807{
1808 // Update active priority registers.
1809 uint32_t prio = hppi.prio & 0xf8;
1810 int apr_bit = prio >> (8 - PRIORITY_BITS);
1811 int reg_bit = apr_bit % 32;
1812 int apr_idx = group == Gicv3::G0S ?
1813 MISCREG_ICC_AP0R0_EL1 : MISCREG_ICC_AP1R0_EL1;

--- 703 unchanged lines hidden ---