Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1250791rwb; Thu, 10 Nov 2022 13:25:18 -0800 (PST) X-Google-Smtp-Source: AMsMyM6vJ4JDLm/Zvww8C9PuLtpf43/t0ab0y60Z2KwCq/nW+l2bUCXeKIiO9IHhM0bYyEkn3YoJ X-Received: by 2002:a17:903:3252:b0:186:59e9:8dca with SMTP id ji18-20020a170903325200b0018659e98dcamr2083194plb.154.1668115518308; Thu, 10 Nov 2022 13:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668115518; cv=none; d=google.com; s=arc-20160816; b=AQ39L7klYzqiVf3tynDP5yqoVivWaNayQGF36kLq1sWOsnoOzQSLfKBSUOs8FRo7Dr C/MSzFP5MlqsypctbYRmrkhETyn3ypSk2mDu6xvhRcJaKmYbjLnWOvtWwO9aiggb2EPW vP+HdjuEbCg68a3jFTYTl3aF1AFd+RcQx1/9O4OElHHmvYqOl1qnybJkcRWKGJTMFCA9 fGSrPKqbRvSr1As8qKwBYXPCHw25PFywECLqeRu9+VUtGY5nNeWy1TGNYqw0MF2UXqrq OXaFWZ53ARAwXn62cmIYtuUJwJcNr40hC2GuwtXk9Y5C0YPynOuPwc14YpluJjfUB9R2 nYGQ== 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:dkim-signature; bh=Rt4kniXmvDtyRf2XxhyuEkQ/wRffXIwXWkCIC4bhcac=; b=ecrcIxexVKdD2t9FsasG44DWurDz8r5CsE6BYsGDEfiCEL9kB1IOAicXw5+zWM6i3/ Rqw8hFHmtsB11e/WOqKWbaQs6zX+B+PG0ztbPPTfppIRA01Xvs4FZgiWvNorUeZ40sst 15BYB1GXNRov0l4be3Ri5xve11g1gJ+yFMk/eHODS2D5G6sh6H3DUd5hECjTWaMs0IR6 Y68tLIRsTvGeoP6DLIPCdVcYXfRPRnNORwQIjQzRtWxbMIWo1nB8YbxgE4iErwOCaW4L J4DVlsPyicUC0fIGsQT/BG0lNrw8QL9ROIbSt7wzJMuK2qXQ4fh/wgE8fdkGoWha5dhn kOOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Livm4Lll; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a654986000000b0046b15902616si303392pgs.270.2022.11.10.13.25.04; Thu, 10 Nov 2022 13:25:18 -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=@redhat.com header.s=mimecast20190719 header.b=Livm4Lll; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232115AbiKJVJy (ORCPT + 92 others); Thu, 10 Nov 2022 16:09:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbiKJVJr (ORCPT ); Thu, 10 Nov 2022 16:09:47 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548812180B for ; Thu, 10 Nov 2022 13:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668114528; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rt4kniXmvDtyRf2XxhyuEkQ/wRffXIwXWkCIC4bhcac=; b=Livm4LllA7aW/GU/JrmWVPnQNs+ZGlKp87MqfZ+LHL3VAfhahcXoY/RBrSqb4AMOzwyJxW Zlw3n8qdRVf2HMBlSDT087NnBJPEUo/GMrvYth1bDFyZlUtZ75GvRhrj4bM3CPCOthZSAy z3QFN0ygCbevIAjMHk4AeNb+G5b7h4s= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-96-W0WdIn5tMrmnuaWy9sTLhg-1; Thu, 10 Nov 2022 16:08:47 -0500 X-MC-Unique: W0WdIn5tMrmnuaWy9sTLhg-1 Received: by mail-ed1-f70.google.com with SMTP id e15-20020a056402190f00b00461b0576620so2295831edz.2 for ; Thu, 10 Nov 2022 13:08:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Rt4kniXmvDtyRf2XxhyuEkQ/wRffXIwXWkCIC4bhcac=; b=lIXp2/0CyPHJ5tARLj3CoQHebbSzBlYSvnfdMdtKD48wL+RY5yjLk2iaXKuLXYXTl5 m0iB4bfxdu2+JlAitYlhApzCQXgIOCMFj4HD40FoFP4B3bx0OGs6R1wzI1X+8v0z03L6 /Izg/2STL6FnSlIcFE2VhZZ5IxFztlATOIMOo/UCYf7+d/XlsEolu+ngyLGfioBx5g/L aBKagnQjJizffVWmKZdktAZ+sJRjIRDkd6WTWCae3W5sMpLedQ8lXXSyuehJQBLjzipm ozW/YNspJ7GS8P8GzruM6cW3YlELMZPe5Rrpc8f6O185gMmdSxaTxkzazr+lQmydW4sM VNPA== X-Gm-Message-State: ACrzQf2LvzgNta757z5vxh4O0Bm8ANzRXnr7o7c6okKlIpYoLPM7wQfL lzINGmD54ywaiAY254ghrvDfgxsjvhC0CGxOn0+ypjBRltb81ORCzWPCxj+0huJghiMInq/yyQD qFrSX70zzKuzDit7bSgEzazrN X-Received: by 2002:a17:906:d7a5:b0:7ad:7e81:1409 with SMTP id pk5-20020a170906d7a500b007ad7e811409mr3872964ejb.326.1668114526141; Thu, 10 Nov 2022 13:08:46 -0800 (PST) X-Received: by 2002:a17:906:d7a5:b0:7ad:7e81:1409 with SMTP id pk5-20020a170906d7a500b007ad7e811409mr3872954ejb.326.1668114525900; Thu, 10 Nov 2022 13:08:45 -0800 (PST) Received: from ?IPV6:2001:1c00:c1e:bf00:d69d:5353:dba5:ee81? (2001-1c00-0c1e-bf00-d69d-5353-dba5-ee81.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:d69d:5353:dba5:ee81]) by smtp.gmail.com with ESMTPSA id i4-20020a170906698400b007ae9c7b3c45sm130639ejr.99.2022.11.10.13.08.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Nov 2022 13:08:45 -0800 (PST) Message-ID: <64d4dd57-24b3-4397-8704-cc8f156b5012@redhat.com> Date: Thu, 10 Nov 2022 22:08:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v2 08/14] platform/x86/intel/ifs: Add metadata support Content-Language: en-US, nl To: Jithu Joseph , markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> <20221107225323.2733518-9-jithu.joseph@intel.com> From: Hans de Goede In-Reply-To: <20221107225323.2733518-9-jithu.joseph@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Hi, On 11/7/22 23:53, Jithu Joseph wrote: > From: Ashok Raj > > One of the existing reserved fields in microcode header has been > allocated to indicate the size for metadata structures. > > The metadata section within microcode header is as shown below: > > Microcode Format > +----------------------+ Base > |Header Version | > +----------------------+ > |Update revision | > +----------------------+ > |Date DDMMYYYY | > +----------------------+ > |Sig | > +----------------------+ > |Checksum | > +----------------------+ > |Loader Version | > +----------------------+ > |Processor Flags | > +----------------------+ > |Data Size | > +----------------------+ > |Total Size | > +----------------------+ > |Meta Size | > +----------------------+ > |Reserved | > +----------------------+ > |Reserved | > +----------------------+ Base+48 > | | > | | > | | > | | > | Microcode | > | | > | Data | > | | > | | > +----------------------+ Base+48+data_size- > | | meta_size > | Meta Data | > | structure(s) | > | | > +----------------------+ Base+48+data_size > | Extended Signature | > | Table | > | | > | | > | | > | | > | | > +----------------------+ Base+total_size > > Add an accessor function which will return a pointer to the > start of a specific meta_type being queried. > > In subsequent patches, IFS test image file (which reuse microcode header > format) will make use of metadata section. > > Reviewed-by: Tony Luck > Signed-off-by: Ashok Raj > Signed-off-by: Jithu Joseph Thanks, patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans > --- > drivers/platform/x86/intel/ifs/load.c | 32 +++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c > index 89ce265887ea..60ba5a057f91 100644 > --- a/drivers/platform/x86/intel/ifs/load.c > +++ b/drivers/platform/x86/intel/ifs/load.c > @@ -44,6 +44,38 @@ static const char * const scan_authentication_status[] = { > [2] = "Chunk authentication error. The hash of chunk did not match expected value" > }; > > +#define META_TYPE_END (0) > + > +struct metadata_header { > + unsigned int type; > + unsigned int blk_size; > +}; > + > +static struct metadata_header *ifs_find_meta_data(void *ucode, unsigned int meta_type) > +{ > + struct metadata_header *meta_header; > + unsigned long data_size, total_meta; > + unsigned long meta_size = 0; > + > + data_size = get_datasize(ucode); > + total_meta = ((struct microcode_intel *)ucode)->hdr.metasize; > + > + if (!total_meta) > + return NULL; > + > + meta_header = (ucode + MC_HEADER_SIZE + data_size) - total_meta; > + > + while ((meta_header->type != META_TYPE_END) && meta_header->blk_size && > + meta_size < total_meta) { > + meta_size += meta_header->blk_size; > + if (meta_header->type == meta_type) > + return meta_header; > + > + meta_header = (void *)meta_header + meta_header->blk_size; > + } > + return NULL; > +} > + > /* > * To copy scan hashes and authenticate test chunks, the initiating cpu must point > * to the EDX:EAX to the test image in linear address.