Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp32249pxm; Tue, 22 Feb 2022 05:53:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7rTKkv5eZR7kg6QGIi/Gfiti75dpbkYHqDHyO7agfqOsgcxcgwHXawLqLR3jco7FxfETZ X-Received: by 2002:a17:90a:eb93:b0:1bb:8ad9:5b79 with SMTP id o19-20020a17090aeb9300b001bb8ad95b79mr4245616pjy.215.1645537981572; Tue, 22 Feb 2022 05:53:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645537981; cv=none; d=google.com; s=arc-20160816; b=R23DuyOolapt77EPY299VlK5Vg1DWk5WvlwhaykvM5vf9dyx+T79XsjccY8prG4SEM 9uXLn8pX8/jgXmqejlXCNUypuZ/lVO2DNx+OvXqBCnSpfbbGdejld9v+T6/NRlFB6kt9 kIOMcqV/Ur9SeNF36Q96cb6vg6bjJqBFIN/8NHJiDpPjZLsSRAp5Vl51oyj/6D67icj/ SpbUvy7g4Gwio1aHUb1/Lgg+scfMm5Sk9mGHbVKfgmSR7GrLSiFG5oN/fdvE/494xr4I lU6KZabhLn89nV38+NSEgHB9R10gHmreYNq+4c1D1JVwT8RBhLwM0NjGcWorDL4GOk06 nnKw== 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=rIzCHu7vWbE7jPkhWFahwChinGRQ+u4nZtOXmNmbih4=; b=SqZq6AbZFm7A/fJQWDHkz++QWdJBBD9ZU5FgbtP8OYjGV6cO9EaP5Js0AiOIZxw0Sp h3I6JQUyMVRglIbzlhVuV5iuIvIQiv9CiHYGXhyktdRl4a5FBm+EkLi2xGo2AA8GoPSt CiFHJm1S5BorGcH5VmJenJUQ7TyvAx7l+J7BvLJHfmlnfTlTjq3gamSNlZ7GqUv2lKLH XYQMWAGN2v+ZcF+luHBIs61yIGxbgDGOj5xmqj+z82lYAe5JgS1kVZL4xS3MDIeeRwu0 D/+EEqw8MzzDX/ra9rBqd69AT8Z1SShbqgZmfFgYdfWSMQ2ZQ3OrO/aWYCKw4AK40oGi uSAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="kvrwwzw/"; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8si34570115plf.38.2022.02.22.05.52.45; Tue, 22 Feb 2022 05:53:01 -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=@alien8.de header.s=dkim header.b="kvrwwzw/"; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbiBVNiH (ORCPT + 99 others); Tue, 22 Feb 2022 08:38:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232421AbiBVNhu (ORCPT ); Tue, 22 Feb 2022 08:37:50 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD1355A5BB for ; Tue, 22 Feb 2022 05:37:25 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C67891EC0478; Tue, 22 Feb 2022 14:37:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1645537039; 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:in-reply-to:in-reply-to: references:references; bh=rIzCHu7vWbE7jPkhWFahwChinGRQ+u4nZtOXmNmbih4=; b=kvrwwzw/InANdZgtVqRFahRs3d9e0TmqgNfvgkv3nElMq/pS9QdZeueLQPz2b1ADnYxNV3 0FI8C0g3kXsug29tDKwI2xKoCJ/Z/EyXGzCW2IwA0wmzGq69DOoWrb9tWgM3u0FCgFFej5 LgS6qcxOnwjwRq2/HuEDdsFpSd8XNPY= Date: Tue, 22 Feb 2022 14:37:27 +0100 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: Dave Hansen , tglx@linutronix.de, mingo@redhat.com, luto@kernel.org, peterz@infradead.org, sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, jgross@suse.com, jmattson@google.com, joro@8bytes.org, jpoimboe@redhat.com, knsathya@kernel.org, pbonzini@redhat.com, sdeep@vmware.com, seanjc@google.com, tony.luck@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv3 02/32] x86/coco: Add API to handle encryption mask Message-ID: References: <20220218161718.67148-1-kirill.shutemov@linux.intel.com> <20220218161718.67148-3-kirill.shutemov@linux.intel.com> <66fcd7e7-deb6-f27e-9fc6-33293ce04f16@intel.com> <20220218213300.2bs4t3admhozonaq@black.fi.intel.com> <7ebd6ba1-85a4-6fee-c897-22ed108ac8b7@intel.com> <20220221222856.c6b74b3n3fwqe6vy@black.fi.intel.com> <20220222110312.q7eaepfph2tyjq3e@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220222110312.q7eaepfph2tyjq3e@black.fi.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Tue, Feb 22, 2022 at 02:03:12PM +0300, Kirill A. Shutemov wrote: > I would rather make cc_mkenc()/cc_mkdec() to operate on u64 (or > phys_addr_t?) while pgprot_encrypted()/pgprot_decrypted() cover pgprot_t. > It also makes set_memory cleaner: > > cpa.mask_set = __pgprot(enc ? cc_mkenc(0) : cc_mkdec(0)); > cpa.mask_clr = __pgprot(enc ? cc_mkdec(0) : cc_mkenc(0)); > > Opinions? Right, do I see it correctly that the cc_mk{enc,dec}() things should take a u64 as an argument and return a pgprot_t, and that would be the most optimal way for all the use cases? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette