Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1094917pxm; Wed, 23 Feb 2022 18:01:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxSOClbGwbkUG3QXywX66aX6GCqkOi07ZJcK1jSovtFkzj6uGYz2kzKdYXgB5l9swtlaBu X-Received: by 2002:a63:e42:0:b0:374:7dae:aa98 with SMTP id 2-20020a630e42000000b003747daeaa98mr516460pgo.586.1645668069338; Wed, 23 Feb 2022 18:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645668069; cv=none; d=google.com; s=arc-20160816; b=PomkUjwMbU0dlOQZgiN9Mxu4nEQYGTTiK6nzky5zI7DJ+Of7gXFm+3jj2yLewOCxF5 6AfZeHqYHWQVdPBvWpioJzSx7k63DEYXeHv8UwoizvO77O+uz16uK/iCLfroj6/iDWL0 1HwGR8r6IGCGXHS6k9OpQRl6in33PSSN++fLVad4ESEcQoIZxixIhpvgsARMMPi6FdR+ yT7LWJufjES1a/9Y82Kl62y1TQ1dd3mZ/F+IStXQzb9NiN8xER8ekWSm68lb7NYLD9TZ +1MkjHYeh7xxdmdMIdNghGRPKdevvyt+fojsRDQ71u2H5aZlpNo+tbV35YpW1ePO9FBV VF7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=oLxhe1+/q/ffytS2x1bnbij1SrGOn3CdIxFKv6xoCNQ=; b=Sne50lNZ4nlAuYPz039cZ2wSuKexgOkDXQBp9tJdqAcrvCXtSxqCEw3m40pAqjDbp3 v+wNdzn5AsZ3kLZ9lgqf6bIxUseBGgRMK+yNmpOpDH0OTddDxyIF1lvrlE5ddhjHxTZh i0hITFKOjcD5DZRxvXuDHs6fIDaNPeH/G6jIfaqJVJQ41E+UEWawS9chpL9Bj2zUVtPZ QW94HefC/ff2P2BssebA6M4caADntJGDc7Ww8DD3vHuyiWjzx1f4SG/+Dxuhc5UluiVU zp3Gn+ZWHyP6Hl/4prTuOKFJX8Fm8RmG5cijs3JxRfbbs3mZjn5OWO3jYexRffG4xxEB XZ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T1Pc4B23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a63si1221387pge.803.2022.02.23.18.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:01:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T1Pc4B23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C55CB21CD0E; Wed, 23 Feb 2022 17:29:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbiBXAsk (ORCPT + 99 others); Wed, 23 Feb 2022 19:48:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbiBXAsj (ORCPT ); Wed, 23 Feb 2022 19:48:39 -0500 Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8077C107AAF; Wed, 23 Feb 2022 16:48:00 -0800 (PST) Received: by mail-oo1-xc34.google.com with SMTP id i10-20020a4aab0a000000b002fccf890d5fso1167289oon.5; Wed, 23 Feb 2022 16:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=oLxhe1+/q/ffytS2x1bnbij1SrGOn3CdIxFKv6xoCNQ=; b=T1Pc4B23cN3s1FGEyr9jrL0b8gag+JUNzErCsCXYOhNTaC9lMQqhiVTDrXqC4kcDz5 4GBMrIYL7Oez63vIGGSOU70kgfUEkiQknd2HqL2t+N5Ohdln0utp/KlJrvhl3Fa6GBN0 bXyabAAVmmb/lusrMmTE/7s5MPg2a0nVzjeQ8lFHlDtm/rMXUSXXdHYL9PJWGDwEFc8Q gMeg9uCvhL9izTnstMr83iWz8QKqjZuYYdZ0Vj/t9PB/vqMMjO2t+9w9mL5DHIM+lXpi 7RlG8RwYAdWVYIa7GH8QBsQuVeq6TKZYoWcEFiEucaDJB7l8XuAN21bWA0fpIxEUIqDD kCgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=oLxhe1+/q/ffytS2x1bnbij1SrGOn3CdIxFKv6xoCNQ=; b=Y/WT2rb2o1wmAN++/ly2RnqTZnbDK1aIOaXY3JQxzU3UN3F4nVosVCwo1I34zXICMu 0Qs3ziwsoMjDzAMXLq5+oQSh+7UgP6pybJ4rIb6NzyCbyw5HQfJe6vfOF7mlnOxEJL+j Vx2V9EoWdq/AUPklixYNzrkMbe5kdzNQV6pwamrrSo4A/tfVdE3CATuQ6z10tntprBvs gZp3tHqNEpXs7y3ReHuPYCQmXezwc2medut4Eo7UaA9JROwZ2R0jw7l4YJda3YrKMGmc jCx4MmbdcwcblhfeShXWBXWC70llzXqORBBtpMoHz1uV1OAhkussAcQB9D4VJenJ9Iwl UzLQ== X-Gm-Message-State: AOAM530swnl5ETu4WebBiC83VgWgkxXM5u6SdR0qMRnI3i2jjMPKblll vrIjQYjwsG29DsikUGzOl88= X-Received: by 2002:a05:6870:aa8a:b0:d6:c3ca:7e9c with SMTP id gr10-20020a056870aa8a00b000d6c3ca7e9cmr52765oab.118.1645663530391; Wed, 23 Feb 2022 16:45:30 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id p13sm578119oiv.23.2022.02.23.16.45.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 16:45:29 -0800 (PST) Sender: Guenter Roeck Message-ID: Date: Wed, 23 Feb 2022 16:45:27 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4] hwmon: (dell-smm) Improve assembly code Content-Language: en-US To: David Laight , 'Armin Wolf' , =?UTF-8?B?J1BhbGkgUm9ow6FyJw==?= Cc: "jdelvare@suse.com" , "linux-hwmon@vger.kernel.org" , "linux-assembly@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20220220190851.17965-1-W_Armin@gmx.de> <20220222165432.GA255373@roeck-us.net> <20220222175150.qs32v4outislnqj6@pali> <4b5ca065-06a4-c1ff-ed16-3bbb038ee6e0@gmx.de> <63a04993864f4c08923ed753d83cdf37@AcuMS.aculab.com> From: Guenter Roeck In-Reply-To: <63a04993864f4c08923ed753d83cdf37@AcuMS.aculab.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/23/22 14:35, David Laight wrote: > From: Armin Wolf >> Sent: 23 February 2022 21:39 > ... >>> As far as this patch goes I think I'd add a 'stc' (set carry) >>> instruction before the first 'outb'. >>> Then if the 'something magic happens here' doesn't happen (because >>> you aren't on the right kind of motherboard) the action fails. >>> >>> David >> >> We already check for such scenarios by checking if eax changed. >> I would not set the carry flag before doing a SMM call since im >> not sure if the firmware code always clears the carry flag when >> the call was successful. >> If for example the firmware code only sets the carry flag on >> error and otherwise ignores the carry flag, we might create some >> false negatives when a successful SMM call leaves the carry flag set. > > If you are worried about that you should be clearing carry on entry. > I agree, but now we have an argument for clearing carry (because the SMM code might not do it) and for setting carry (because the SMM code might not execute). I don't know which way to go, if any, but that would be a functional change and should be submitted as separate patch. Guenter