From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0431C61DA4 for ; Thu, 9 Mar 2023 12:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbjCIMAF (ORCPT ); Thu, 9 Mar 2023 07:00:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbjCIL7r (ORCPT ); Thu, 9 Mar 2023 06:59:47 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E822DDAB80; Thu, 9 Mar 2023 03:59:45 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (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 4E4001EC03CA; Thu, 9 Mar 2023 12:59:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1678363184; 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=90vFMcU1aj7MNl0YJWHq0D+SdgqMmwppIDssNkGHN0s=; b=qiiJY7lCp+bHxVH6C28W+gwzLyykdT2M2oNSDZWtkL8aMO7DJ2N4sOH42a0CCM8tVyB+r9 FwX2ofvtwttj/UgIJETiFm7w1MLPzUyE1KS1uBIBuJw1QfPYSuP6AD5YlvEMj/M7TqnDal MOJgdA8GVC26djw3lokZIYc9Pq/ibZE= Date: Thu, 9 Mar 2023 12:59:37 +0100 From: Borislav Petkov To: David Woodhouse , "thomas.lendacky@amd.com" , =?utf-8?B?SsO2cmcgUsO2ZGVs?= Cc: Dave Hansen , "Michael Kelley (LINUX)" , Sean Christopherson , "hpa@zytor.com" , KY Srinivasan , Haiyang Zhang , "wei.liu@kernel.org" , Dexuan Cui , "luto@kernel.org" , "peterz@infradead.org" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "lpieralisi@kernel.org" , "robh@kernel.org" , "kw@linux.com" , "bhelgaas@google.com" , "arnd@arndb.de" , "hch@lst.de" , "m.szyprowski@samsung.com" , "robin.murphy@arm.com" , "brijesh.singh@amd.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "dave.hansen@linux.intel.com" , Tianyu Lan , "kirill.shutemov@linux.intel.com" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "ak@linux.intel.com" , "isaku.yamahata@intel.com" , "dan.j.williams@intel.com" , "jane.chu@oracle.com" , "tony.luck@intel.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-arch@vger.kernel.org" , "iommu@lists.linux.dev" Subject: Re: [PATCH v5 06/14] x86/ioremap: Support hypervisor specified range to map as encrypted Message-ID: <20230309115937.GAZAnKKRef99EwOu/S@fat_crate.local> References: <255249f2-47af-07b7-d9d9-9edfdd108348@intel.com> <20230306215104.GEZAZgSPa4qBBu9lRd@fat_crate.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org First of all, thanks for proactively pointing that out instead of simply using what's there and we get to find out later, only by chance. Much appreciated. :-) On Thu, Mar 09, 2023 at 11:12:10AM +0000, David Woodhouse wrote: > > Right, I think we're ok with the following basic rules: > > > > - pure arch/x86/ code should use the x86_platform function pointers to > >   query hypervisor capabilities/peculiarities > > > > - cc_platform_has() should be used in generic/driver code as it > >   abstracts away the underlying platform better. IOW, querying > >   x86_platform.... in generic, platform-agnostic driver code looks weird to > >   say the least > > > > The hope is that those two should be enough to support most guest types > > and not let the zoo get too much out of hand... > > > > Thx. > > In > https://lore.kernel.org/all/20230308171328.1562857-13-usama.arif@bytedance.com/ > I added an sev_es_active() helper for x86 code. > > Is that consistent with the vision here, or should I do something different? So looking at sev_es_init_vc_handling() where we set that key, I'm *thinking* that key can be removed now and the code should check cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT) instead. Because if some of the checks in that function below fail, the guest will terminate anyway. Jörg, Tom? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette