When enable hypervisor, it is no need to set irq
target twice for root cell, otherwise it will waste time.

Signed-off-by: Dongjiu Geng <[email protected]>
---
How to re-produce this issue
1. Make below modification as shown below[1]
2. Run the hypervisor as shown in the log[2]
3. You will see the added log "cell_added_removed == &root_cell".
4. That is to say irqchip.adjust_irq_target() will be called two
   times in [4] and [5] for root cell when hypervisor initializes.

[1]:
diff --git a/hypervisor/arch/arm-common/irqchip.c 
b/hypervisor/arch/arm-common/irqchip.c
index a3245846..48973d06 100644
--- a/hypervisor/arch/arm-common/irqchip.c
+++ b/hypervisor/arch/arm-common/irqchip.c
@@ -510,6 +510,9 @@ void irqchip_config_commit(struct cell *cell_added_removed)
 {
        unsigned int n;

+       if (cell_added_removed == &root_cell)
+               printk("cell_added_removed == &root_cell\n");
+
        if (!cell_added_removed)
                return;

        for (n = 32; n < sizeof(cell_added_removed->arch.irq_bitmap) * 8; n++) {
                if (irqchip_irq_in_cell(cell_added_removed, n)) {
[4]:                    irqchip.adjust_irq_target(cell_added_removed, n);
                }
                if (irqchip_irq_in_cell(&root_cell, n)) {
[5]:                    irqchip.adjust_irq_target(&root_cell, n);
                }
        }
}

[2]:
Initializing Jailhouse hypervisor v0.12 (273-g6d9c51d0-dirty) on CPU 6
Code location: 0x0000ffffc0200800
Page pool usage after early setup: mem 87/994, remap 0/131072
Initializing processors:
 CPU 6... OK
 CPU 3... OK
 CPU 10... OK
 CPU 8... OK
 CPU 0... OK
 CPU 4... OK
 CPU 11... OK
 CPU 12... OK
 CPU 7... OK
 CPU 1... OK
 CPU 9... OK
 CPU 2... OK
 CPU 5... OK
 CPU 14... OK
 CPU 13... OK
 CPU 15... OK
Initializing unit: irqchip
Initializing unit: ARM SMMU v3
Initializing unit: ARM SMMU
Initializing unit: PVU IOMMU
Initializing unit: PCI
Adding virtual PCI device 00:00.0 to cell "qemu-arm64"
Adding virtual PCI device 00:01.0 to cell "qemu-arm64"
cell_added_removed == &root_cell
Page pool usage after late setup: mem 144/994, remap 528/131072
Activating hypervisor
---
 hypervisor/arch/arm-common/irqchip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/arm-common/irqchip.c 
b/hypervisor/arch/arm-common/irqchip.c
index a3245846..256af114 100644
--- a/hypervisor/arch/arm-common/irqchip.c
+++ b/hypervisor/arch/arm-common/irqchip.c
@@ -514,8 +514,10 @@ void irqchip_config_commit(struct cell *cell_added_removed)
                return;
 
        for (n = 32; n < sizeof(cell_added_removed->arch.irq_bitmap) * 8; n++) {
-               if (irqchip_irq_in_cell(cell_added_removed, n))
+               if (irqchip_irq_in_cell(cell_added_removed, n) &&
+                       (cell_added_removed != &root_cell))
                        irqchip.adjust_irq_target(cell_added_removed, n);
+
                if (irqchip_irq_in_cell(&root_cell, n))
                        irqchip.adjust_irq_target(&root_cell, n);
        }
-- 
2.17.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20210624142731.30102-1-gengdongjiu1%40gmail.com.

Reply via email to