[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH 11/23] hw/intc/arm_gicv3: Implement GICv3 distribu
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [PATCH 11/23] hw/intc/arm_gicv3: Implement GICv3 distributor registers |
Date: |
Fri, 13 May 2016 16:24:57 +0100 |
On 13 May 2016 at 16:05, Shannon Zhao <address@hidden> wrote:
> On 2016年05月10日 01:29, Peter Maydell wrote:
>> +static MemTxResult gicd_writeb(GICv3State *s, hwaddr offset,
>> + uint64_t value, MemTxAttrs attrs)
>> +{
>> + /* Most GICv3 distributor registers do not support byte accesses. */
>> + switch (offset) {
>> + case GICD_CPENDSGIR ... GICD_CPENDSGIR + 0xf:
>> + case GICD_SPENDSGIR ... GICD_SPENDSGIR + 0xf:
>> + case GICD_ITARGETSR ... GICD_ITARGETSR + 0x3ff:
>> + /* This GIC implementation always has affinity routing enabled,
>> + * so these registers are all RAZ/WI.
>> + */
>> + return MEMTX_OK;
>> + case GICD_IPRIORITYR ... GICD_IPRIORITYR + 0x3ff:
>> + {
>> + int irq = offset - GICD_IPRIORITYR;
>> +
>> + gicd_write_ipriorityr(s, attrs, irq, value);
>> + gicv3_update(s, irq, 1);
> The GICv3 SPEC says:
> "
> When affinity routing is enabled for the security state of an interrupt:
> • GICR_IPRIORITYR<n> is used instead of GICD_IPRIORITYR<n> where n = 0
> to 7 (that
> is, for SGIs and PPIs).
> • GICD_IPRIORITYR<n> is RAZ/WI where n = 0 to 7.
> "
>
> So I think it shouldn't call gicv3_update if attrs.secure is true and
> irq < 32. And it should check the parameter irq in gicv3_update().
If irq < 32 then gicd_write_ipriority() will return without
doing anything. We'll unnecessarily call gicv3_update(), but that
does no harm, and I don't think being slightly inefficient for
an access a correctly functioning guest will never make is a big problem.
>> + switch (offset) {
>> + case GICD_CTLR:
>> + if (!attrs.secure && !(s->gicd_ctlr & GICD_CTLR_DS)) {
>> + /* The NS view of the GICD_CTLR sees only certain bits:
>> + * + bit [31] (RWP) is an alias of the Secure bit [31]
>> + * + bit [4] (ARE_NS) is an alias of Secure bit [5]
>> + * + bit [1] (EnableGrp1A) is an alias of Secure bit [1] if
>> + * NS affinity routing is enabled, otherwise RES0
>> + * + bit [0] (EnableGrp1) is an alias of Secure bit [1] if
>> + * NS affinity routing is not enabled, otherwise RES0
>> + * Since for QEMU affinity routing is always enabled
>> + * for both S and NS this means that bits [4] and [5] are
>> + * both always 1, and we can simply make the NS view
>> + * be bits 31, 4 and 1 of the S view.
>> + */
>> + *data = s->gicd_ctlr & (GICD_CTLR_ARE_NS |
> As you said, we make the NS view be bit 4 of the S view. So the
> GICD_CTLR_ARE_NS should be GICD_CTLR_ARE_S, right?
Yes, you're right, this should be GICD_CTLR_ARE_S.
>> + GICD_CTLR_EN_GRP1NS |
>> + GICD_CTLR_RWP);
>> + } else {
>> + *data = s->gicd_ctlr;
>> + }
>> + return MEMTX_OK;
thanks
-- PMM
- Re: [Qemu-arm] [PATCH 03/23] target-arm: Define new arm_is_el3_or_mon() function, (continued)
- [Qemu-arm] [PATCH 01/23] migration: Define VMSTATE_UINT64_2DARRAY, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 02/23] bitops.h: Implement half-shuffle and half-unshuffle ops, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 15/23] hw/intc/arm_gicv3: Implement GICv3 CPU interface registers, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 04/23] target-arm: Provide hook to tell GICv3 about changes of security state, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 12/23] hw/intc/arm_gicv3: Implement GICv3 redistributor registers, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 07/23] hw/intc/arm_gicv3: Move irq lines into GICv3CPUState structure, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 05/23] target-arm: Add mp-affinity property for ARM CPU class, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 11/23] hw/intc/arm_gicv3: Implement GICv3 distributor registers, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 08/23] hw/intc/arm_gicv3: Add vmstate descriptors, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 10/23] hw/intc/arm_gicv3: Implement functions to identify next pending irq, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 09/23] hw/intc/arm_gicv3: ARM GICv3 device framework, Peter Maydell, 2016/05/09
- [Qemu-arm] [PATCH 06/23] hw/intc/arm_gicv3: Add state information, Peter Maydell, 2016/05/09
- Re: [Qemu-arm] [Qemu-devel] [PATCH 00/23] GICv3 emulation, Shannon Zhao, 2016/05/11