Skip to contentSkip to conversation

libxl: implement trigger s3resume

PATCH Applied Stefano Stabellini 2 participants 4 messages Jan 10, 2011 – Feb 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: implement trigger s3resume

Implement trigger s3resume

This is the equivalent of xm trigger s3resume and it is implemented the same way: using an ACPI state change.

tools/libxl/libxl.c +8 -2
diff -r 1ae74f060a39 tools/libxl/libxl.c
@@ -2668,8 +2668,14 @@ static int trigger_type_from_string(char
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint32_t vcpuid)
 {
     int rc = -1;
-    int trigger_type = trigger_type_from_string(trigger_name);
-
+    int trigger_type = -1;
+
+    if (!strcmp(trigger_name, "s3resume")) {
+        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, 0);
+        return 0;
+    }
+
+    trigger_type = trigger_type_from_string(trigger_name);
     if (trigger_type == -1) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
             "Invalid trigger, valid triggers are <nmi|reset|init|power|sleep>");
#1 lore raw

Stefano Stabellini writes ("[Xen-devel] [PATCH] libxl: implement trigger s3resume"):

Quoted 4 lines

Implement trigger s3resume

This is the equivalent of xm trigger s3resume and it is implemented the same way: using an ACPI state change.

The code here is a bit odd - callers are apparently expected to pass strings rather than enums through into the libxl API. I think trigger_type_from_string ought to be libxlu_...

But given the current code and the state of freeze we shouldn't do that now.

This is clearly a low-impact new feature and I'm inclined to make exception to the freeze for it. Have you tested the patch ? Anyone object ?

Thanks,
Ian.

#2 lore raw
Quoted 10 lines · Ian Jackson

Stefano Stabellini writes ("[Xen-devel] [PATCH] libxl: implement trigger s3resume"):

Quoted 4 lines

Implement trigger s3resume

This is the equivalent of xm trigger s3resume and it is implemented the same way: using an ACPI state change.

The code here is a bit odd - callers are apparently expected to pass strings rather than enums through into the libxl API. I think trigger_type_from_string ought to be libxlu_...

Quoted 6 lines

But given the current code and the state of freeze we shouldn't do that now.

This is clearly a low-impact new feature and I'm inclined to make exception to the freeze for it. Have you tested the patch ? Anyone object ?

I forgot to reply to this, but yes I tested it.

Applied
#3 lore raw

Stefano Stabellini writes ("Re: [Xen-devel] [PATCH] libxl: implement trigger s3resume"):

Quoted 1 line

I forgot to reply to this, but yes I tested it.

I've applied the patch, thanks.

Ian.