Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4785177rwb; Sun, 13 Nov 2022 13:48:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Vg+F/RFvm78hveK8UGIgDNdN/H96H1/973pREQg1NkZUCNRndiJ0gI4pY55eBH81hCJSN X-Received: by 2002:a17:902:efc4:b0:176:a6c5:20c9 with SMTP id ja4-20020a170902efc400b00176a6c520c9mr11315637plb.57.1668376097864; Sun, 13 Nov 2022 13:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668376097; cv=none; d=google.com; s=arc-20160816; b=RyMWIHFBwgnDyewi010beDjUz6o7Mkk4cd9MtNUE6I355TCy8/YP4g8J5nxKMnuDpa pzc7ig6bhB8jtg/c1DJm7k6dUQ+azpwZHOLmQ84DAgIgDE9CMnoF7wfvzpYhx3jc5/F/ VFy+k6wnhO+TAfwU18aSjNAif+KDtnV02c76lUN1CPvwP8lpKQiGPKK6bs9fWCXwOpN8 ZAApnBohmAECFTunDn90n5U2gcwlkBPmQqH7mqvd7lcKpmZUZB5o5gPkm0mzaiRpkX8P QnNkhxGLqeddndho63YsiLgYR3leWPndHrxO9cm0iyL3lRDUpyoF6+Jj2qttZmtOXfc/ r2ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u0JYBHnPqvkBo+aLCpigiiBpC4TOOKXgEgk44OU7Gds=; b=TYVjqJC4g+5W5vyIEUvTnRCldoQ8O95lvaAHQDplmUXOG5orOCtld10pOKEJyoDtyB fWqYSMYLrxdbILWxZQVw7EHs/xIQVQVt3idAsWto6VO9wtYl2kk8IlaKAvodLMWeUYMI Tsy/sITjy17U+GR28Xqwe1ZsmMEWfMjBZfekllZi6jApzld4sj2uuyQNVdG3JlP5G63V ZT9jfgzipY3paTWeYKKgFqfRopHI/SgtoNIOBCLTKZWYOc/b8r1lwQ0QsM3O+vkcjJrE TVENHogLTG+bBfMdstBTqMQlukKEeD3kcO0CH01714JuSVBEzOwlMGiaGNM4TZbQwn0o O5Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lY2r250v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170903024e00b00186e3781ae2si8998868plh.316.2022.11.13.13.48.05; Sun, 13 Nov 2022 13:48:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lY2r250v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235416AbiKMVdy (ORCPT + 91 others); Sun, 13 Nov 2022 16:33:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbiKMVdx (ORCPT ); Sun, 13 Nov 2022 16:33:53 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D1ADA1A7; Sun, 13 Nov 2022 13:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668375232; x=1699911232; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gDsXd/OK/i8ZazYsmMhzsAb7ml0526jel4iO8E7C1A4=; b=lY2r250vlLioCXMAX7u1Ml/lC4xRm7lfSJH9Gs4CUvQhMw0XzTsSkvdU qjcwWKHq86Do2ajlNVEGgHWwTl8pFYHmWpGeyAfe9LyzsMNq0v1D4rV7r YoqlR0AE48mwzrTleU/QSJpKrTFvRB98h5D6u3iVYMsubPUarw7RiiVb6 /fBmwJ/2FOTM27L3hsB5FPyL21nBSVUkJZP8hc5EzuzjsQaEX+bnWvHHQ wz1NT1TrJQmjpkjbqsI2oNZDpcuBDKGBlvQ4sS1iQRDprTgHeRuK98IyQ wHYP9SlSxnK/T2hbLo4/OTbVp0uXW3ZpNr1G3c4lIODc70EwAM67UQfFt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10530"; a="373970396" X-IronPort-AV: E=Sophos;i="5.96,161,1665471600"; d="scan'208";a="373970396" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2022 13:33:52 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10530"; a="616053966" X-IronPort-AV: E=Sophos;i="5.96,161,1665471600"; d="scan'208";a="616053966" Received: from agluck-desk3.sc.intel.com ([172.25.222.78]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2022 13:33:51 -0800 Date: Sun, 13 Nov 2022 13:33:50 -0800 From: Tony Luck To: Borislav Petkov Cc: "Joseph, Jithu" , "gregkh@linuxfoundation.org" , Thiago Macieira , "hdegoede@redhat.com" , "markgross@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "Raj, Ashok" , "linux-kernel@vger.kernel.org" , "platform-driver-x86@vger.kernel.org" , "patches@lists.linux.dev" , "Shankar, Ravi V" , "Jimenez Gonzalez, Athenas" , "Mehta, Sohil" Subject: Re: [PATCH v2 12/14] platform/x86/intel/ifs: Add current_batch sysfs entry Message-ID: References: <20221107225323.2733518-1-jithu.joseph@intel.com> <20221107225323.2733518-13-jithu.joseph@intel.com> <5e65889d-d68c-b29d-6cea-7b4ce4c87b4a@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 Sun, Nov 13, 2022 at 07:27:26PM +0100, Borislav Petkov wrote: > On Sun, Nov 13, 2022 at 09:55:00AM -0800, Joseph, Jithu wrote: > > Then we were told not to specify a filename via sysfs file (apologies > > for being repetitive) > > Yeah, I'm unclear on why that is either and am hoping that Greg will > clarify. He fears that there will be file path resolution which I'm not > even thinking about. Summarizing the competing proposals here: Option 1 (patches as currently posted) User writes the batch number to the sysfs file: # echo 4 > /sys/devices/virtual/misc/intel_ifs_0/current_batch Driver turns that into a *partial* path (with test type, family-model-stepping and batch number filled in): "intel/ifs_%d/%02x-%02x-%02x-%02x.scan" Feeds that to request_firmware_direct() (which looks in /lib/firmware) Option 2 (proposed by Boris) User writes a filename to the sysfs file: # echo 06-8f-06-04.scan > /sys/devices/virtual/misc/intel_ifs_0/current_batch Driver parses that: If family-mode-stepping does not match current CPU, then fail with -EINVAL If filename doesn't end with a ".scan" suffix, also fails with -EINVAL Otherwise proceeds in similar manner to above. Constructs partial pathname (just fills in test type and filename: "intel/ifs_%d/%s" Feeds that to request_firmware_direct() (which looks in /lib/firmware) IMHO option 1 is following the microcode precedent of having the kernel construct the filename based on the {x86,model,stepping} fields of struct cpuinfo_x86. I think option 2 isn't really doing the user any favors. Having them feed all the *.scan files they find in /lib/firmware/intel/ifs_0 to the driver to see which ones work becomes progressively worse in every CPU generation. Any script/app running tests is likely to do the ff-mm-ss filter itself ... so why have the kernel do it too? -Tony