hw/s390x: provide loadparm property for the machine
In order to specify the LOADPARM value one may now add ",loadparm=xxx" parameter to the "-machine s390-ccw-virtio" option. The property setter will normalize and check the value provided much like the way the HMC does. The value is stored, but not used at the moment. Initial patch from Eugene (jno) Dvurechenski. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
38bb54f323
commit
7104bae9de
|
@ -274,6 +274,36 @@ bool cpu_model_allowed(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *machine_get_loadparm(Object *obj, Error **errp)
|
||||||
|
{
|
||||||
|
S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
|
||||||
|
|
||||||
|
return g_memdup(ms->loadparm, sizeof(ms->loadparm));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void machine_set_loadparm(Object *obj, const char *val, Error **errp)
|
||||||
|
{
|
||||||
|
S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) {
|
||||||
|
uint8_t c = toupper(val[i]); /* mimic HMC */
|
||||||
|
|
||||||
|
if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') ||
|
||||||
|
(c == ' ')) {
|
||||||
|
ms->loadparm[i] = c;
|
||||||
|
} else {
|
||||||
|
error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
|
||||||
|
c, c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; i < sizeof(ms->loadparm); i++) {
|
||||||
|
ms->loadparm[i] = ' '; /* pad right with spaces */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void s390_machine_initfn(Object *obj)
|
static inline void s390_machine_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
object_property_add_bool(obj, "aes-key-wrap",
|
object_property_add_bool(obj, "aes-key-wrap",
|
||||||
|
@ -291,6 +321,13 @@ static inline void s390_machine_initfn(Object *obj)
|
||||||
"enable/disable DEA key wrapping using the CPACF wrapping key",
|
"enable/disable DEA key wrapping using the CPACF wrapping key",
|
||||||
NULL);
|
NULL);
|
||||||
object_property_set_bool(obj, true, "dea-key-wrap", NULL);
|
object_property_set_bool(obj, true, "dea-key-wrap", NULL);
|
||||||
|
object_property_add_str(obj, "loadparm",
|
||||||
|
machine_get_loadparm, machine_set_loadparm, NULL);
|
||||||
|
object_property_set_description(obj, "loadparm",
|
||||||
|
"Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
|
||||||
|
" to upper case) to pass to machine loader, boot manager,"
|
||||||
|
" and guest kernel",
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo ccw_machine_info = {
|
static const TypeInfo ccw_machine_info = {
|
||||||
|
|
|
@ -28,6 +28,7 @@ typedef struct S390CcwMachineState {
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
bool aes_key_wrap;
|
bool aes_key_wrap;
|
||||||
bool dea_key_wrap;
|
bool dea_key_wrap;
|
||||||
|
uint8_t loadparm[8];
|
||||||
} S390CcwMachineState;
|
} S390CcwMachineState;
|
||||||
|
|
||||||
typedef struct S390CcwMachineClass {
|
typedef struct S390CcwMachineClass {
|
||||||
|
|
Loading…
Reference in a new issue