Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4867749iob; Mon, 9 May 2022 03:36:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/g/lgcqiRYSzWZAVA07yA/qShhSbm9Oj9LGTzmmgVtAXlbHP0Om21zRMGwpD6jWon20iq X-Received: by 2002:a5e:820a:0:b0:649:5b8:d02c with SMTP id l10-20020a5e820a000000b0064905b8d02cmr6333212iom.50.1652092576371; Mon, 09 May 2022 03:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652092576; cv=none; d=google.com; s=arc-20160816; b=tF97Ux0FwFIxVMuBSmfcDMqDgkeUvQXU+r3okW1SUYQako0I+LTZX9dK3NJlzVVYbt erRO63hQ6n8EbQ83frx3ygBp/fWWS2epp7heKd7DibJxoyIia7A8Wn82Zyl1dZpPr0pn n7MNwbN6EcQwoFtQZO82WbayRLbFxAwWGtR7ghswQfRw7zXq5X4kaphF0ZjVqoxHI1aN ZzAl7IYHu0OThLYxkXyYMS3cZTSk/cxSoBipJmLRi8D9qAOZunHRM3TTTlFt1uB8ntt/ b2fKWCY3DKkKnz0vSxuY+cfWTsKEF6OskL41ZVpadjAkTHGDglBApo/Qua7SCjLjbbWC v1SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=viBGPAXuNsA7zjTMIINHaGbiAR7IRO1hyoh+kfXxmY0=; b=0EdYy5jLSyrOuhs8qeyYlutZcXSBFEampeirscOJ1Ij6F6Uva5HviCCj//iQprgm3r NIJ9WTd7u7c12hWT670LEqmrV16xCfq6qvGItFZCTKzHbPpXGEK9a1MdGLWqUP/YdMxK ukiRNE/+iP/ENfUfh6aSmmjLDhoFuhhidgHWC6GVDgqYqY469jRzkLfyM0J2Zbj7LrAe HxbM6u+/wduWLjsPH3TJDb0HPZ5FmyDLyGfRM26PKrms7MTS9GaH1blakvSj5kd0pK3F YSmB8KytdyK0P8gKOC59mVc2aQVzTv2hTnOO7eGYveb0yzzYLp1sMERhoedsZXgqO6DP VHlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=fQNZFMRg; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y11-20020a056e02178b00b002cf89626c74si5984691ilu.105.2022.05.09.03.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 03:36:16 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=fQNZFMRg; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 106D8179969; Mon, 9 May 2022 03:05:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236235AbiEII1A (ORCPT + 99 others); Mon, 9 May 2022 04:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235627AbiEIIOx (ORCPT ); Mon, 9 May 2022 04:14:53 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3E4D1D043B; Mon, 9 May 2022 01:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652083626; bh=viBGPAXuNsA7zjTMIINHaGbiAR7IRO1hyoh+kfXxmY0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fQNZFMRgksIrIe1fiR8JNLrpFt4Y/x5UnAfyjEue7NREmwhU9WxIsr3JGc53N6Dzl Qc/X7kRseIZiHGWlcFObZ5EJ5xI4xV9WcWvcUyTkY1EqgKeiuXfN5O1DMpTzdz5tUO hhYdrplLxh/Iv8YVgz63okbLgBiStTAAbdolUG6k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([46.223.3.89]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N8GQy-1nsDak1Bqq-014A2v; Mon, 09 May 2022 10:07:06 +0200 From: Lino Sanfilippo To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca Cc: stefanb@linux.vnet.ibm.com, linux@mniewoehner.de, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com, Lino Sanfilippo Subject: [PATCH v4 2/6] tpm, tpm_tis: Claim and release locality only once Date: Mon, 9 May 2022 10:05:55 +0200 Message-Id: <20220509080559.4381-3-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220509080559.4381-1-LinoSanfilippo@gmx.de> References: <20220509080559.4381-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:EzX1A8+1f3IydNHHtPhvWaoNMgzrH3pWX0+iA3ZGSjVn4WzbSiA 7tXpS9EjNgRGfvsQOnVJp3W41Q/mmT7PpH5i1JayytG5WGP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fJuenmUIY750h0cyQFu495CtwrLtBjBTymiBjPHxm4xDO73cTLTZkJ+ormVYxZtYFZFQtiW fowMvZhU0MqpJpci1WqcyQFP5eikxZhN4CpUuVbtN784l7ae+oq2W02xhY9NwaQf+StUTZaJ5 zKYxt3cC0QnTantCHBbUREFv3TyYN8LJCxdVM86H5nXhVnBT7RbboG81EY5SRl1x2inritw3B 2Znek6pLqvoJWg= X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MIME_BASE64_TEXT, 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 RnJvbTogTGlubyBTYW5maWxpcHBvIDxsLnNhbmZpbGlwcG9Aa3VuYnVzLmNvbT4KCkl0IGlzIG5v dCBuZWNlc3NhcnkgdG8gY2xhaW0gYW5kIHJlbGVhc2UgdGhlIGRlZmF1bHQgbG9jYWxpdHkgZm9y IGVhY2ggVFBNCmNvbW1hbmQuIEluc3RlYWQgY2xhaW0gdGhlIGxvY2FsaXR5IG9uY2UgYXQgZHJp dmVyIHN0YXJ0dXAgYW5kIHJlbGVhc2UgaXQKYXQgZHJpdmVyIHNodXRkb3duLgoKU2lnbmVkLW9m Zi1ieTogTGlubyBTYW5maWxpcHBvIDxsLnNhbmZpbGlwcG9Aa3VuYnVzLmNvbT4KLS0tCiBkcml2 ZXJzL2NoYXIvdHBtL3RwbV90aXNfY29yZS5jIHwgNTAgKysrKysrKysrLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tCiAxIGZpbGUgY2hhbmdlZCwgMTMgaW5zZXJ0aW9ucygrKSwgMzcgZGVsZXRpb25z KC0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