From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753699AbdJSSMb (ORCPT ); Thu, 19 Oct 2017 14:12:31 -0400 Received: from esa7.dell-outbound.iphmx.com ([68.232.153.96]:45649 "EHLO esa7.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751406AbdJSSMa (ORCPT ); Thu, 19 Oct 2017 14:12:30 -0400 From: X-LoopCount0: from 10.166.132.169 X-IronPort-AV: E=Sophos;i="5.43,402,1503378000"; d="scan'208";a="162740951" X-DLP: DLP_GlobalPCIDSS To: CC: , , , , , , , , , , Subject: RE: [PATCH v10 11/15] platform/x86: dell-smbios-smm: test for WSMT Thread-Topic: [PATCH v10 11/15] platform/x86: dell-smbios-smm: test for WSMT Thread-Index: AQHTSQVs5n0qbgbse0SrPX6X2h2sb6LreS5A Date: Thu, 19 Oct 2017 18:12:09 +0000 Message-ID: <9065712bf6b14fc680ba03738b369947@ausx13mpc120.AMER.DELL.COM> References: <657d281490de3d0a60f210f8bc57e075c9afc40e.1508434514.git.mario.limonciello@dell.com> <20171019180926.h6lnfwnapswybtcb@pali> In-Reply-To: <20171019180926.h6lnfwnapswybtcb@pali> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.242.75] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v9JICZ4s002547 > -----Original Message----- > From: Pali Rohár [mailto:pali.rohar@gmail.com] > Sent: Thursday, October 19, 2017 1:09 PM > To: Limonciello, Mario > Cc: dvhart@infradead.org; Andy Shevchenko ; > LKML ; platform-driver-x86@vger.kernel.org; Andy > Lutomirski ; quasisec@google.com; rjw@rjwysocki.net; > mjg59@google.com; hch@lst.de; Greg KH ; Alan Cox > > Subject: Re: [PATCH v10 11/15] platform/x86: dell-smbios-smm: test for WSMT > > On Thursday 19 October 2017 12:50:14 Mario Limonciello wrote: > > +/* When enabled this indicates that SMM won't work */ > > +static bool test_wsmt_enabled(void) > > +{ > > + struct calling_interface_token *token; > > + > > + /* if token doesn't exist, SMM will work */ > > + token = dell_smbios_find_token(WSMT_EN_TOKEN); > > + if (!token) > > + return false; > > + > > + /* if token exists, try to access over SMM */ > > + buffer->class = CLASS_TOKEN_READ; > > + buffer->select = SELECT_TOKEN_STD; > > + memset(buffer, 0, sizeof(struct calling_interface_buffer)); > > + buffer->input[0] = token->location; > > + dell_smbios_smm_call(buffer); > > + > > + /* if lookup failed, we know WSMT was enabled */ > > + if (buffer->output[0] != 0) > > + return true; > > + > > + /* query token status if it didn't fail */ > > + return (buffer->output[1] == token->value); > > +} > > + > > static int __init dell_smbios_smm_init(void) > > { > > int ret; > > @@ -115,6 +140,13 @@ static int __init dell_smbios_smm_init(void) > > > > dmi_walk(find_cmd_address, NULL); > > > > + ret = test_wsmt_enabled(); > > ret is int, but test_wsmt_enabled() returns bool. Yes, ret is re-used within this method. 0, 1 enum is a subset of int, so this seemed like a logical thing to me to do.