Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm_arm: use gic path to find phandle #52

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/VM_Arm/plat_include/exynos5410/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define VUSB_NINDEX 5
#define VUSB_NBADGE 0x123
#define IRQ_SPI_OFFSET 32
#define GIC_IRQ_PHANDLE 0x1
#define GIC_NODE_PATH "/soc/interrupt-controller@10481000"

#define LINUX_RAM_BASE 0x40000000
#define LINUX_RAM_PADDR_BASE LINUX_RAM_BASE
Expand Down
2 changes: 1 addition & 1 deletion components/VM_Arm/plat_include/exynos5422/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define INITRD_ADDR (DTB_ADDR - INITRD_MAX_SIZE) //0x4D700000

#define IRQ_SPI_OFFSET 32
#define GIC_IRQ_PHANDLE 0x1
#define GIC_NODE_PATH "/soc/interrupt-controller@10481000"

static const int linux_pt_irqs[] = {
};
Expand Down
2 changes: 1 addition & 1 deletion components/VM_Arm/plat_include/odroidc2/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#pragma once

#define IRQ_SPI_OFFSET 32
#define GIC_IRQ_PHANDLE 0x01
#define GIC_NODE_PATH "/interrupt-controller@c4301000"

static const int linux_pt_irqs[] = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define INITRD_ADDR (DTB_ADDR - INITRD_MAX_SIZE) //0x4D700000

#define IRQ_SPI_OFFSET 32
#define GIC_IRQ_PHANDLE 0x8001
#define GIC_NODE_PATH "/intc@8000000"

static const int linux_pt_irqs[] = {};

Expand Down
2 changes: 1 addition & 1 deletion components/VM_Arm/plat_include/tk1/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static const int free_plat_interrupts[] = { -1 };
#define DTB_ADDR (LINUX_RAM_BASE + 0x02000000)
#define INITRD_MAX_SIZE 0x1900000 //25 MB
#define INITRD_ADDR (DTB_ADDR - INITRD_MAX_SIZE) //0x80700000
#define GIC_IRQ_PHANDLE 0x1
#define GIC_NODE_PATH "/interrupt-controller@50041000"

static const char *plat_keep_device_and_disable[] = {
"/gpu@0,57000000",
Expand Down
2 changes: 1 addition & 1 deletion components/VM_Arm/plat_include/tx1/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static const int free_plat_interrupts[] = { -1 };
#define DTB_ADDR (LINUX_RAM_BASE + 0x02000000)
#define INITRD_MAX_SIZE 0x1900000 //25 MB
#define INITRD_ADDR (DTB_ADDR - INITRD_MAX_SIZE) //0x80700000
#define GIC_IRQ_PHANDLE 0x1
#define GIC_NODE_PATH "/interrupt-controller@50041000"

static const char *plat_keep_devices[] = {
"/interrupt-controller@50041000",
Expand Down
2 changes: 1 addition & 1 deletion components/VM_Arm/plat_include/tx2/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static const int free_plat_interrupts[] = { 220 + GIC_LIC_INTID_BASE };
#define DTB_ADDR (LINUX_RAM_BASE + 0x01000000)
#define INITRD_MAX_SIZE 0x1900000 //25 MB
#define INITRD_ADDR (DTB_ADDR - INITRD_MAX_SIZE) //0x80700000
#define GIC_IRQ_PHANDLE 0x1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that the GIC_NODE_PATH has to match with the name in the DTS, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

#define GIC_NODE_PATH "/interrupt-controller@3881000"

static const char *plat_keep_devices[] = {
"/arm-pmu",
Expand Down
12 changes: 11 additions & 1 deletion components/VM_Arm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,17 @@ static int generate_fdt(vm_t *vm, void *fdt_ori, void *gen_fdt, int buf_size, si
}

if (config_set(CONFIG_VM_PCI_SUPPORT)) {
err = fdt_generate_vpci_node(vm, pci, gen_fdt, GIC_IRQ_PHANDLE);
int gic_offset = fdt_path_offset(fdt_ori, GIC_NODE_PATH);
axel-h marked this conversation as resolved.
Show resolved Hide resolved
if (gic_offset < 0) {
ZF_LOGE("Failed to find gic node from path: %s", GIC_NODE_PATH);
chrisguikema marked this conversation as resolved.
Show resolved Hide resolved
return -1;
}
int gic_phandle = fdt_get_phandle(fdt_ori, gic_offset);
if (0 == gic_phandle) {
ZF_LOGE("Failed to find phandle in gic node");
return -1;
}
err = fdt_generate_vpci_node(vm, pci, gen_fdt, gic_phandle);
if (err) {
ZF_LOGE("Couldn't generate vpci_node (%d)\n", err);
return -1;
Expand Down