From patchwork Mon Sep 2 12:11:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11126515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EB5B1399 for ; Mon, 2 Sep 2019 12:13:39 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19416206B8 for ; Mon, 2 Sep 2019 12:13:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="VSu1xpak" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19416206B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i4lBd-0007LZ-Fr; Mon, 02 Sep 2019 12:11:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i4lBc-0007LP-AC for xen-devel@lists.xenproject.org; Mon, 02 Sep 2019 12:11:56 +0000 X-Inumbo-ID: d9b80081-cd7a-11e9-aea1-12813bfff9fa Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d9b80081-cd7a-11e9-aea1-12813bfff9fa; Mon, 02 Sep 2019 12:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567426316; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CqgR/RHdhNltlblA7nkz/ZnEPWCzyYZ4hsOB0ToZdVE=; b=VSu1xpakTmYN+rLf/ZV8iV7NwnmqR/t4w3MFqQd6f6SmfcRsGdPnKsm3 lnP9/OzGqUIJkVR6EyTCRDwU98kg+I/g9j7JbyFAahpNsWuwxay52FlsO gBoaYXzgdguPfqa6n3LWRN3FFXv4/rn9NP+ZeyZsP/INKUkriRtOhM/3x 8=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: bro0QrskLfeX/GqsCO+LDMZ89xz1HF+7pk80gs3KslECtevHUfIH9acPsMHARtM28adm1hO+Xp ogy7sUmgIR1Ae4qeYNFlAJGzqLSQZxavIY0q71/kh603vVklECFyY2lBgqlVt0R9IkYh9AXeFw gMONqd4Mk8pj7lCEnQgWqSDsEZZTH2HpwaIuERVqNYjKN/bwHqKoemQ4U6IgeZ3w+lUf0YD3QD jYoZiS9O2GeGrL7hKvqEzjSqF0Me/C7BiwzHoh7UQf8yZ+unAk7UCF+v+em0RC0rBa/hSr/n9n v/o= X-SBRS: 2.7 X-MesageID: 5064152 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,459,1559534400"; d="scan'208";a="5064152" From: Andrew Cooper To: Xen-devel Date: Mon, 2 Sep 2019 13:11:51 +0100 Message-ID: <20190902121151.11384-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190902121151.11384-1-andrew.cooper3@citrix.com> References: <20190902121151.11384-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/2] x86/apci: Adjust command line parsing for "acpi_sleep" X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Perform parsing in a custom_param, rather than stashing the content in a string and parsing in an initcall. Adjust the parsing to conform to current standards. No practical change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné The reason that flags is pulled into a local variable is that the codegen for acpi_video_flags is attrocious, 260 bytes!, and doubles up when used twice. --- xen/arch/x86/acpi/power.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 6ae9e29229..1ce5de221e 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -33,8 +33,32 @@ uint32_t system_reset_counter = 1; -static char __initdata opt_acpi_sleep[20]; -string_param("acpi_sleep", opt_acpi_sleep); +static int parse_acpi_sleep(const char *s) +{ + const char *ss; + unsigned int flag = 0; + int rc = 0; + + do { + ss = strchr(s, ','); + if ( !ss ) + ss = strchr(s, '\0'); + + if ( !cmdline_strcmp(s, "s3_bios") ) + flag |= 1; + else if ( !cmdline_strcmp(s, "s3_mode") ) + flag |= 2; + else + rc = -EINVAL; + + s = ss + 1; + } while ( *ss ); + + acpi_video_flags = flag; + + return 0; +} +custom_runtime_param("acpi_sleep", parse_acpi_sleep); static DEFINE_SPINLOCK(pm_lock); @@ -456,22 +480,3 @@ acpi_status acpi_enter_sleep_state(u8 sleep_state) return_ACPI_STATUS(AE_OK); } - -static int __init acpi_sleep_init(void) -{ - char *p = opt_acpi_sleep; - - while ( (p != NULL) && (*p != '\0') ) - { - if ( !strncmp(p, "s3_bios", 7) ) - acpi_video_flags |= 1; - if ( !strncmp(p, "s3_mode", 7) ) - acpi_video_flags |= 2; - p = strchr(p, ','); - if ( p != NULL ) - p += strspn(p, ", \t"); - } - - return 0; -} -__initcall(acpi_sleep_init);