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

Distinct flag for guest android (civ) #152

Open
wants to merge 1 commit into
base: celadon/r/mr0/stable
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
10 changes: 10 additions & 0 deletions src/guest/aaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ static const char *suspend_support[] = {
[AAF_SUSPEND_ENABLE] = "suspend:true"
};

static const char *civ_flag_support[] = {
[AAF_CIV_DISABLE] = "civ_flag:false",
[AAF_CIV_ENABLE] = "civ_flag:true"
};

static char *aaf_file = NULL;

static const char *aaf_config_array[AAF_CONFIG_NUM] = { NULL };
Expand Down Expand Up @@ -105,6 +110,11 @@ int set_aaf_option(aaf_config_opt_t opt, unsigned int sub)
return -1;
aaf_config_array[AAF_CONFIG_GPU_TYPE] = gpu_type[sub];
break;
case AAF_CONFIG_CIV:
if (sub >AAF_CIV_DISABLE)
return -1;
aaf_config_array[AAF_CONFIG_CIV] = civ_flag_support[sub];
break;
default:
fprintf(stderr, "%s: Invalid AAF config option!\n", __func__);
break;
Expand Down
7 changes: 7 additions & 0 deletions src/guest/guest.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ int load_form_data(char *name)
set_field_data(FORM_INDEX_AAF_PATH, val);
val = g_key_file_get_string(in, g->name, g->key[AAF_SUSPEND], NULL);
set_field_data(FORM_INDEX_AAF_SUSPEND, val);
val = g_key_file_get_string(in, g->name, g->key[AAF_CIV], NULL);
set_field_data(FORM_INDEX_AAF_CIV, val);

g = &g_group[GROUP_GUEST_SERVICE];
val = g_key_file_get_string(in, g->name, g->key[GUEST_TIME_KEEP], NULL);
Expand Down Expand Up @@ -315,6 +317,11 @@ int generate_keyfile(void)
g_key_file_set_string(out, g_group[GROUP_AAF].name, g_group[GROUP_AAF].key[AAF_SUSPEND], temp);
}

get_field_data(FORM_INDEX_AAF_CIV, temp, sizeof(temp) - 1);
if (0 == check_field(g_group[GROUP_AAF].key[AAF_CIV], temp)) {
g_key_file_set_string(out, g_group[GROUP_AAF].name, g_group[GROUP_AAF].key[AAF_CIV], temp);
}

get_field_data(FORM_INDEX_PCI_PT, temp, sizeof(temp) - 1);
g_key_file_set_string(out, g_group[GROUP_PCI_PT].name, g_group[GROUP_PCI_PT].key[PCI_PT], temp);

Expand Down
10 changes: 10 additions & 0 deletions src/guest/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,16 @@ int start_guest(char *name)
else
g_warning("Invalid setting of AAF Allow suspend option, it should be either true or false\n");
}

val = g_key_file_get_string(gkf, g->name, g->key[AAF_CIV], NULL);
if (val) {
if (0 == strcmp(val, CIV_ENABLE_STR))
set_aaf_option(AAF_CONFIG_CIV, AAF_CIV_ENABLE);
else if (0 == strcmp(val, CIV_DISABLE_STR))
set_aaf_option(AAF_CONFIG_CIV, AAF_CIV_DISABLE);
else
g_warning("Invalid setting of AAF Allow CiV option, it should be either true or false\n");
}
}

g = &g_group[GROUP_VGPU];
Expand Down
1 change: 1 addition & 0 deletions src/guest/tui.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ int set_field_data(form_index_t index, const char *in)
set_field_buffer(g_form_field_data[index].input.f, 0, buf);
break;
case FORM_INDEX_AAF_SUSPEND:
case FORM_INDEX_AAF_CIV:
set_opts_buffer(g_form_field_data[index].input.f, in);
break;
default:
Expand Down
10 changes: 8 additions & 2 deletions src/include/guest/aaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@
typedef enum {
AAF_CONFIG_GPU_TYPE = 0,
AAF_CONFIG_SUSPEND,
AAF_CONFIG_NUM
AAF_CONFIG_NUM,
AAF_CONFIG_CIV
} aaf_config_opt_t;

enum {
AAF_SUSPEND_DISABLE = 0,
AAF_SUSPEND_ENABLE
};

enum {
AAF_CIV_DISABLE = 0,
AAF_CIV_ENABLE
};

enum {
AAF_GPU_TYPE_VIRTIO = 0,
AAF_GPU_TYPE_GVTG,
Expand All @@ -29,4 +35,4 @@ int set_aaf_path(const char *bin_path);
int set_aaf_option(aaf_config_opt_t opt, unsigned int sub);
int flush_aaf_config(void);

#endif /* __AAF_H__ */
#endif /* __AAF_H__ */
2 changes: 2 additions & 0 deletions src/include/guest/guest.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef enum {
FORM_INDEX_THERMAL_MED,
FORM_INDEX_AAF_PATH,
FORM_INDEX_AAF_SUSPEND,
FORM_INDEX_AAF_CIV,
FORM_INDEX_GUEST_TIME_KEEP,
FORM_INDEX_PM_CONTROL,
FORM_INDEX_EXTRA_CMD,
Expand Down Expand Up @@ -183,6 +184,7 @@ enum {
/* Sub key of group aaf */
AAF_PATH = 0,
AAF_SUSPEND,
AAF_CIV,

/* Guest services */
GUEST_TIME_KEEP = 0,
Expand Down