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 7BCC5C636D4 for ; Fri, 10 Feb 2023 20:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233726AbjBJU6D (ORCPT ); Fri, 10 Feb 2023 15:58:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233528AbjBJU6A (ORCPT ); Fri, 10 Feb 2023 15:58:00 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7764018B30 for ; Fri, 10 Feb 2023 12:57:58 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id d13-20020a17090ad3cd00b0023127b2d602so6745696pjw.2 for ; Fri, 10 Feb 2023 12:57:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=evdRb0y0uW0suzf6IqaYt5x7djfotbgzG0ewIjt0Uk8=; b=KUT+l2F2GWE7igSYQ8d5+p5+59DtVXpCEXbLlVmc96yZz0C6BTvOrxsmTe+OBsGL6s y2rzOIBMtqUvWwibc6YD8yAi5yQL/cH6XRbNvg4K7cDiXdcIFRxcLSduB35wUWXXA0VJ UeK9Fr3MnD+UOG5bxYvcENuScn2VK2MbwHDh6DLWlTMMB6ENfQqUGQCX/ex0dNBaX4/L Vh+BtiM/GbqdCb8E9zZUPWET+0t1LsXdZfKblrGrFj3BpftIY518+n8kbXbPsSi8YbwV /d3USSewKz7NLQ6A/T63dPWA2RxNmCM816H+HjOkO44vyORTTbVJHwxomoZAon+9gPk5 VCWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=evdRb0y0uW0suzf6IqaYt5x7djfotbgzG0ewIjt0Uk8=; b=ECC4w1t4Y2gc6a4qN81UaQf97m/VegVtw/4ZMTRlM2mPzO5jzRGYfyD9Ldr6ORLI/e eXlt3eFB9nbpoqZxO9CV5uzvd9eZXFAj59wR3eEddOg6lVOu3SEfRlZJAzAtwqVGyp/5 zMEhsHJMVFsPFJbmNUGWaCtOdngozXyq3dLQjTJ/E2/QL1ulmDs+zpZZgCBa5PV5Hxr1 AhoTlJ8lBhs9Q/S3z8Vi0ns5Kp57j3slS/lYi0kZf+ot1m/5FrxVo70M5ARuA/QS2/Nq +d9+lfFektjMafsewWIyzz9j4GPE0nAgqgGF4O3WZGIgF00Wb+Y/GCCISHWQRqqzeCWa SMJw== X-Gm-Message-State: AO0yUKXvSPDfqobe0cW5JvGCpydBK9e9lN2qKxoH3cAc/IjPIGpxoFDQ 1/wv01T8JkC95dXhZs8IQOw+qA== X-Google-Smtp-Source: AK7set9CwV4ClXZtXo/ecYginhuJqO7iCZWxx36BetrGYm8vH3+HGalmqFIH3VMl3TsAt45IiN7jgw== X-Received: by 2002:a17:903:111:b0:198:af4f:de12 with SMTP id y17-20020a170903011100b00198af4fde12mr42392plc.18.1676062677683; Fri, 10 Feb 2023 12:57:57 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id ms16-20020a17090b235000b00233864f21a7sm2070323pjb.51.2023.02.10.12.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 12:57:57 -0800 (PST) Date: Fri, 10 Feb 2023 20:57:53 +0000 From: Sean Christopherson To: Dave Hansen Cc: Borislav Petkov , "Michael Kelley (LINUX)" , "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" , "thomas.lendacky@amd.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: References: <4216dea6-d899-aecb-2207-caa2ae7db0e3@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 10, 2023, Sean Christopherson wrote: > On Fri, Feb 10, 2023, Dave Hansen wrote: > > On 2/10/23 11:36, Borislav Petkov wrote: > > >> One approach is to go with the individual device attributes for now.>> If the list does grow significantly, there will probably be patterns > > >> or groupings that we can't discern now. We could restructure into > > >> larger buckets at that point based on those patterns/groupings. > > > There's a reason the word "platform" is in cc_platform_has(). Initially > > > we wanted to distinguish attributes of the different platforms. So even > > > if y'all don't like CC_ATTR_PARAVISOR, that is what distinguishes this > > > platform and it *is* one platform. > > > > > > So call it CC_ATTR_SEV_VTOM as it uses that technology or whatever. But > > > call it like the platform, not to mean "I need this functionality". > > > > I can live with that. There's already a CC_ATTR_GUEST_SEV_SNP, so it > > would at least not be too much of a break from what we already have. > > I'm fine with CC_ATTR_SEV_VTOM, assuming the proposal is to have something like: > > static inline bool is_address_range_private(resource_size_t addr) > { > if (cc_platform_has(CC_ATTR_SEV_VTOM)) > return is_address_below_vtom(addr); > > return false; > } > > i.e. not have SEV_VTOM mean "I/O APIC and vTPM are private". Though I don't see > the point in making it SEV vTOM specific or using a flag. Despite what any of us > think about TDX paravisors, it's completely doable within the confines of TDX to > have an emulated device reside in the private address space. E.g. why not > something like this? > > static inline bool is_address_range_private(resource_size_t addr) > { > return addr < cc_platform_private_end; > } > > where SEV fills in "cc_platform_private_end" when vTOM is enabled, and TDX does > the same. Or wrap cc_platform_private_end in a helper, etc. Gah, forgot that the intent with TDX is to enumerate devices in their legacy address spaces. So a TDX guest couldn't do this by default, but if/when Hyper-V or some other hypervisor moves I/O APIC, vTPM, etc... into the TCB, the common code would just work and only the hypervisor-specific paravirt code would need to change. Probably need a more specific name than is_address_range_private() though, e.g. is_mmio_address_range_private()?