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

[zcu102] add gicv2 support #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion include/zone_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ typedef struct pci_config pci_config_t;
#ifdef ARM64
struct arch_zone_config {
__u64 gicd_base;
__u64 gicr_base;
__u64 gicd_size;
__u64 gicr_base;
__u64 gicr_size;
__u64 gits_base;
__u64 gits_size;
__u64 gicc_base;
__u64 gicc_offset;
__u64 gicc_size;
__u64 gich_base;
__u64 gich_size;
__u64 gicv_base;
__u64 gicv_size;
};
#endif

Expand Down
2 changes: 1 addition & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ ivc_demo: $(ivc_demo_objects)
$(CC) -o $@ $^ $(include_dirs)

clean:
rm -f hvisor ivc_demo *.o *.d *.d.*
rm -f hvisor ivc_demo *.o *.d *.d.*
36 changes: 34 additions & 2 deletions tools/hvisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,58 @@ static int parse_arch_config(cJSON *root, zone_config_t *config) {
cJSON *gicd_base_json = cJSON_GetObjectItem(arch_config_json, "gicd_base");
cJSON *gicr_base_json = cJSON_GetObjectItem(arch_config_json, "gicr_base");
cJSON *gits_base_json = cJSON_GetObjectItem(arch_config_json, "gits_base");
cJSON *gicc_base_json = cJSON_GetObjectItem(arch_config_json, "gicc_base");
cJSON *gich_base_json = cJSON_GetObjectItem(arch_config_json, "gich_base");
cJSON *gicv_base_json = cJSON_GetObjectItem(arch_config_json, "gicv_base");
cJSON *gicc_offset_json = cJSON_GetObjectItem(arch_config_json, "gicc_offset");
cJSON *gicv_size_json = cJSON_GetObjectItem(arch_config_json, "gicv_size");
cJSON *gich_size_json = cJSON_GetObjectItem(arch_config_json, "gich_size");
cJSON *gicc_size_json = cJSON_GetObjectItem(arch_config_json, "gicc_size");
cJSON *gicd_size_json = cJSON_GetObjectItem(arch_config_json, "gicd_size");
cJSON *gicr_size_json = cJSON_GetObjectItem(arch_config_json, "gicr_size");
cJSON *gits_size_json = cJSON_GetObjectItem(arch_config_json, "gits_size");

CHECK_JSON_NULL(gicd_base_json, "gicd_base")
CHECK_JSON_NULL(gicr_base_json, "gicr_base")
CHECK_JSON_NULL(gicc_base_json, "gicc_base")
CHECK_JSON_NULL(gich_base_json, "gich_base")
CHECK_JSON_NULL(gicv_base_json, "gicv_base")
CHECK_JSON_NULL(gicc_offset_json, "gicc_offset")
CHECK_JSON_NULL(gicv_size_json, "gicv_size")
CHECK_JSON_NULL(gich_size_json, "gich_size")
CHECK_JSON_NULL(gicc_size_json, "gicc_size")
CHECK_JSON_NULL(gicd_size_json, "gicd_size")
CHECK_JSON_NULL(gicr_size_json, "gicr_size")

if (gits_base_json == NULL || gits_size_json == NULL) {
printf("No gits fields in arch_config.\n");
} else {
config->arch_config.gits_base = strtoull(gits_base_json->valuestring, NULL, 16);
config->arch_config.gits_size = strtoull(gits_size_json->valuestring, NULL, 16);
}

fprintf(stderr,"###############################################\n");
config->arch_config.gicd_base = strtoull(gicd_base_json->valuestring, NULL, 16);
fprintf(stderr,"gicd_base: %llx\n", config->arch_config.gicd_base);
config->arch_config.gicr_base = strtoull(gicr_base_json->valuestring, NULL, 16);
fprintf(stderr,"gicr_base: %llx\n", config->arch_config.gicr_base);
config->arch_config.gicc_base = strtoull(gicc_base_json->valuestring, NULL, 16);
fprintf(stderr,"gicc_base: %llx\n", config->arch_config.gicc_base);
config->arch_config.gich_base = strtoull(gich_base_json->valuestring, NULL, 16);
fprintf(stderr,"gich_base: %llx\n", config->arch_config.gich_base);
config->arch_config.gicv_base = strtoull(gicv_base_json->valuestring, NULL, 16);
fprintf(stderr,"gicv_base: %llx\n", config->arch_config.gicv_base);
config->arch_config.gicc_offset = strtoull(gicc_offset_json->valuestring, NULL, 16);
fprintf(stderr,"gicc_offset: %llx\n", config->arch_config.gicc_offset);
config->arch_config.gicv_size = strtoull(gicv_size_json->valuestring, NULL, 16);
fprintf(stderr,"gicv_size: %llx\n", config->arch_config.gicv_size);
config->arch_config.gich_size = strtoull(gich_size_json->valuestring, NULL, 16);
fprintf(stderr,"gich_size: %llx\n", config->arch_config.gich_size);
config->arch_config.gicc_size = strtoull(gicc_size_json->valuestring, NULL, 16);
fprintf(stderr,"gicc_size: %llx\n", config->arch_config.gicc_size);
config->arch_config.gicd_size = strtoull(gicd_size_json->valuestring, NULL, 16);
fprintf(stderr,"gicd_size: %llx\n", config->arch_config.gicd_size);
config->arch_config.gicr_size = strtoull(gicr_size_json->valuestring, NULL, 16);
fprintf(stderr,"gicr_size: %llx\n", config->arch_config.gicr_size);
#endif

#ifdef RISCV64
Expand Down