Message ID | 20190806165429.19327-6-brijesh.singh@amd.com |
---|---|
State | New |
Headers | show |
Series | Add SEV guest live migration support | expand |
* Singh, Brijesh (brijesh.singh@amd.com) wrote: > To enable a memory encryption inside a VM, user must pass the object > name used for the encryption in command line parameter as shown below. > > # $(QEMU) \ > -machine memory-encryption=<object_name> > > Add a helper machine_memory_encryption_enabled() which will return a bool > indicating whether the encryption object has been specified in the command > line parameter. > > Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> There's a check in accel/kvm/kvm-all.c:kvm_init which has: if (ms->memory_encryption) { which you might want to replace by this. Dave > --- > hw/core/machine.c | 5 +++++ > include/hw/boards.h | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/hw/core/machine.c b/hw/core/machine.c > index c58a8e594e..f1e1b3661f 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -1031,6 +1031,11 @@ bool machine_mem_merge(MachineState *machine) > return machine->mem_merge; > } > > +bool machine_memory_encryption_enabled(MachineState *machine) > +{ > + return machine->memory_encryption ? true : false; > +} > + > static char *cpu_slot_to_string(const CPUArchId *cpu) > { > GString *s = g_string_new(NULL); > diff --git a/include/hw/boards.h b/include/hw/boards.h > index a71d1a53a5..c5446a39cf 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -76,6 +76,7 @@ void machine_set_cpu_numa_node(MachineState *machine, > Error **errp); > > void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); > +bool machine_memory_encryption_enabled(MachineState *machine); > > > /** > -- > 2.17.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On 8/7/19 11:14 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.singh@amd.com) wrote: >> To enable a memory encryption inside a VM, user must pass the object >> name used for the encryption in command line parameter as shown below. >> >> # $(QEMU) \ >> -machine memory-encryption=<object_name> >> >> Add a helper machine_memory_encryption_enabled() which will return a bool >> indicating whether the encryption object has been specified in the command >> line parameter. >> >> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > > There's a check in accel/kvm/kvm-all.c:kvm_init which has: > if (ms->memory_encryption) { > > which you might want to replace by this. Ah, sure will make the changes in next rev. thanks > Dave > >> --- >> hw/core/machine.c | 5 +++++ >> include/hw/boards.h | 1 + >> 2 files changed, 6 insertions(+) >> >> diff --git a/hw/core/machine.c b/hw/core/machine.c >> index c58a8e594e..f1e1b3661f 100644 >> --- a/hw/core/machine.c >> +++ b/hw/core/machine.c >> @@ -1031,6 +1031,11 @@ bool machine_mem_merge(MachineState *machine) >> return machine->mem_merge; >> } >> >> +bool machine_memory_encryption_enabled(MachineState *machine) >> +{ >> + return machine->memory_encryption ? true : false; >> +} >> + >> static char *cpu_slot_to_string(const CPUArchId *cpu) >> { >> GString *s = g_string_new(NULL); >> diff --git a/include/hw/boards.h b/include/hw/boards.h >> index a71d1a53a5..c5446a39cf 100644 >> --- a/include/hw/boards.h >> +++ b/include/hw/boards.h >> @@ -76,6 +76,7 @@ void machine_set_cpu_numa_node(MachineState *machine, >> Error **errp); >> >> void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); >> +bool machine_memory_encryption_enabled(MachineState *machine); >> >> >> /** >> -- >> 2.17.1 >> > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff --git a/hw/core/machine.c b/hw/core/machine.c index c58a8e594e..f1e1b3661f 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1031,6 +1031,11 @@ bool machine_mem_merge(MachineState *machine) return machine->mem_merge; } +bool machine_memory_encryption_enabled(MachineState *machine) +{ + return machine->memory_encryption ? true : false; +} + static char *cpu_slot_to_string(const CPUArchId *cpu) { GString *s = g_string_new(NULL); diff --git a/include/hw/boards.h b/include/hw/boards.h index a71d1a53a5..c5446a39cf 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -76,6 +76,7 @@ void machine_set_cpu_numa_node(MachineState *machine, Error **errp); void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); +bool machine_memory_encryption_enabled(MachineState *machine); /**
To enable a memory encryption inside a VM, user must pass the object name used for the encryption in command line parameter as shown below. # $(QEMU) \ -machine memory-encryption=<object_name> Add a helper machine_memory_encryption_enabled() which will return a bool indicating whether the encryption object has been specified in the command line parameter. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- hw/core/machine.c | 5 +++++ include/hw/boards.h | 1 + 2 files changed, 6 insertions(+)