From patchwork Mon Sep 2 12:14:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11126521 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 5BE8A14F7 for ; Mon, 2 Sep 2019 12:16:29 +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 3788B206B8 for ; Mon, 2 Sep 2019 12:16:29 +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="en6GdqFh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3788B206B8 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 1i4lEk-0007Z4-7T; Mon, 02 Sep 2019 12:15:10 +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 1i4lEj-0007Yy-6r for xen-devel@lists.xenproject.org; Mon, 02 Sep 2019 12:15:09 +0000 X-Inumbo-ID: 4d8325d0-cd7b-11e9-aea1-12813bfff9fa Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4d8325d0-cd7b-11e9-aea1-12813bfff9fa; Mon, 02 Sep 2019 12:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567426508; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wLEkaV6ms5gU8RgRUu1/pZdh19+1yvzMwiM9139zOJY=; b=en6GdqFhMNLxRU1HJQwDA/af0ZKd/pCuaR2a2XLmqmf9Pk2WQTbth/E/ P/HZhLkGlgZxeUMWA6DwucLTSNX4NWguiTQBonmbwKya0tbsiF4VfKehq pr/Xv2657eMH29Gu1ZkYDkmzBGHRhHXSQwy18qr6AmUQUdaOC79Jurtny A=; Authentication-Results: esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: G3S4Ha172P3YSv3GJY/H6Xf1GgEixxjKUP+9K9OsRu5HYsV7SiJNcmhCGLqTi63tHRo5H6vQar l30ozMdRTJ+I7KI8/OQc6mykcVU/kYHzaFh4DgUFRxyec9IBuk7Ps7HpXJJxkQqjA0kysNi1ee iWtBeunC3GRM/l247/JGLQkU0O3+Yd0YxN6ScvTyK3OoPp7cIsTtWPBmuKLOV/ldYnwTin/eTh mQdceijd52isqn/W66YNYGwdBhDlK90SB1tlcZUO009k/pduKQ+/1xZ+/jXHYJbJ1opA43k08m faQ= X-SBRS: 2.7 X-MesageID: 5024762 X-Ironport-Server: esa3.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="5024762" From: Andrew Cooper To: Xen-devel Date: Mon, 2 Sep 2019 13:14:59 +0100 Message-ID: <20190902121459.11855-1-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 Reviewed-by: Jan Beulich --- 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..414bda205d 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 __init 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_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);