From patchwork Fri Apr 1 07:14:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 8721291 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BBA179F38C for ; Fri, 1 Apr 2016 07:17:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8207203E6 for ; Fri, 1 Apr 2016 07:17:31 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 990F2203B6 for ; Fri, 1 Apr 2016 07:17:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1altI5-0007Rp-OE; Fri, 01 Apr 2016 07:14:45 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1altI4-0007RL-MD for xen-devel@lists.xenproject.org; Fri, 01 Apr 2016 07:14:44 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 81/F6-09532-3EF1EF65; Fri, 01 Apr 2016 07:14:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVyuP0Ov+5j+X9 hBptvSlh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlzrn5hLGjirfj36wBTA+Nvri5GTg4JASOJ txP/MXUxcnEICSxklDh+agczSIJNQFViw/VTrCC2iICjxOq2pWA2s8BGZold2+tBbGEBf4kff 7aD1bMA1f/p2MgOYvMK2EtM+rCcHWKBnMSU++1MIDangIPEpYPTwOqFgGo+vpjIOIGRewEjwy pG9eLUorLUIl1DvaSizPSMktzEzBxdQwMzvdzU4uLE9NScxKRiveT83E2MQO8yAMEOxp3PnQ4 xSnIwKYny6gr/CxPiS8pPqcxILM6ILyrNSS0+xCjDwaEkwXtCDignWJSanlqRlpkDDDOYtAQH j5IIrwow1IR4iwsSc4sz0yFSpxgVpcR5L4L0CYAkMkrz4NpgoX2JUVZKmJcR6BAhnoLUotzME lT5V4ziHIxKwrx8ION5MvNK4Ka/AlrMBLS4QxpscUkiQkqqgdFjQfLanvlLRBK/zShVWnZIwP iCrkDKwbS76q6OoUpR7zVsDpko7rm7LHWb4vXkhH+T9G+vebZc68qaKTdEl/ltLOE3ykhbsGy mFtf9mtd9b7jXRfZu4/+42f7yo95ggxjL6TmmVZ/3TH56ZMOrBA5z5zf9oezvfee4tyduZXl8 JHWL6GKxWe+VWIozEg21mIuKEwG9nQ+KaAIAAA== X-Env-Sender: jgross@suse.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1459494883!6940651!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40942 invoked from network); 1 Apr 2016 07:14:43 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-6.tower-21.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 1 Apr 2016 07:14:43 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77069AC8D; Fri, 1 Apr 2016 07:14:39 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Fri, 1 Apr 2016 09:14:32 +0200 Message-Id: <1459494874-12194-5-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1459494874-12194-1-git-send-email-jgross@suse.com> References: <1459494874-12194-1-git-send-email-jgross@suse.com> Cc: Juergen Gross , jeremy@goop.org, jdelvare@suse.com, peterz@infradead.org, hpa@zytor.com, akataria@vmware.com, x86@kernel.org, rusty@rustcorp.com.au, virtualization@lists.linux-foundation.org, chrisw@sous-sol.org, mingo@redhat.com, david.vrabel@citrix.com, Douglas_Warzecha@dell.com, pali.rohar@gmail.com, boris.ostrovsky@oracle.com, tglx@linutronix.de, linux@roeck-us.net Subject: [Xen-devel] [PATCH v3 4/6] hwmon: use smp_call_sync_on_phys_cpu() for dell-smm i8k X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the smp_call_sync_on_phys_cpu() function to call system management mode on cpu 0. Signed-off-by: Juergen Gross --- drivers/hwmon/dell-smm-hwmon.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index c43318d..4875462 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -130,23 +130,15 @@ static inline const char *i8k_get_dmi_data(int field) /* * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard. */ -static int i8k_smm(struct smm_regs *regs) +static int i8k_smm_func(void *par) { int rc; + struct smm_regs *regs = par; int eax = regs->eax; - cpumask_var_t old_mask; /* SMM requires CPU 0 */ - if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) - return -ENOMEM; - cpumask_copy(old_mask, ¤t->cpus_allowed); - rc = set_cpus_allowed_ptr(current, cpumask_of(0)); - if (rc) - goto out; - if (smp_processor_id() != 0) { - rc = -EBUSY; - goto out; - } + if (smp_processor_id() != 0) + return -EBUSY; #if defined(CONFIG_X86_64) asm volatile("pushq %%rax\n\t" @@ -204,13 +196,18 @@ static int i8k_smm(struct smm_regs *regs) if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax) rc = -EINVAL; -out: - set_cpus_allowed_ptr(current, old_mask); - free_cpumask_var(old_mask); return rc; } /* + * Call the System Management Mode BIOS. + */ +static int i8k_smm(struct smm_regs *regs) +{ + return smp_call_sync_on_phys_cpu(0, i8k_smm_func, regs); +} + +/* * Read the fan status. */ static int i8k_get_fan_status(int fan)