Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3188018rwb; Fri, 20 Jan 2023 12:28:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuE1syEYEBb6GM9O+CoSBYm/gZb+UjNIIS2NlU6TdYW1fOe95uZwCkhLQ4mn3MKRYH7Jup/ X-Received: by 2002:a17:90b:4f8b:b0:22b:b9d9:48e7 with SMTP id qe11-20020a17090b4f8b00b0022bb9d948e7mr1808177pjb.39.1674246531408; Fri, 20 Jan 2023 12:28:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674246531; cv=none; d=google.com; s=arc-20160816; b=UT/a0QxAdS0glpNzonqdYw4EmfPwQ/8F2SFeUIrK/+UYsROl4btgM8XDZdnHPz3dss LHXLYxR+pkV+r+5bXO5EVKTxWL77jyD1pg9HJQPFjLPV2v6xpyPEmWooUwUeP9qpBA+H vMP8YYJOKldjEIeQz50aPb78IXm315N0V8lVd1BGUovzNyzQP86Vh3kAsKHXW3N27JbQ xwPQUWv1U1JNTutydyXN4396FnNgO1o6amv0Y1e9H7uICks888Nnc7cwGL5ItKUSZ3fz KLTTt89hEEo5xKadTzB9ZcmCwQwIyZXaBkewcDNngWmebWWIztpcb15pKeyWyNovvte+ sSMw== 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=URGCdxWMZB194yM7DqWI/LMbwc4I1xa66tqKx+JFPCM=; b=dznee+ziFrTtWN4WvB6JFVUItfaTfGBHthP4of41p4F1v1yok8tFvfZDICtVc4e6el pqzJBs2DDc+HyaTNCMKKczmeXxo4CDLk5WqdXN3BCOE+dpthX/VxyX1sj8MXkITvU97J 3l1RzJPswEgWknJzSgkLO2H0yqn4LT7JhmmNWHJzEpk3lvXRBYd1LmEF+38B3oHS4Omr gr3mLAzZTqZjMagwi29c7Qs/kxtthYG20m+iQibIIEOzWqLPuQBpmJfCNjdS47r7jfOh 4KLRHbZa2zl7lheC3L3isfGpYeqKOMtQ4LB5g278bxpOJaWbd4l3ne+VA8LIJWgfcG5D EeZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="miS51UW/"; 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 k186-20020a6384c3000000b004cffaea14f8si10367004pgd.816.2023.01.20.12.28.44; Fri, 20 Jan 2023 12:28:51 -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="miS51UW/"; 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 S230194AbjATUPU (ORCPT + 52 others); Fri, 20 Jan 2023 15:15:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230021AbjATUPS (ORCPT ); Fri, 20 Jan 2023 15:15:18 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7167CAED83; Fri, 20 Jan 2023 12:15:17 -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 E66031EC068B; Fri, 20 Jan 2023 21:15:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1674245716; 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=URGCdxWMZB194yM7DqWI/LMbwc4I1xa66tqKx+JFPCM=; b=miS51UW/cZawfDQzsiX5CMN7crQiXDw1rMl2UJLaGR2uSVeW8sv9hplnApztEqWEwfO7Jh PtnaNoT5kqitY/1kkbgEHXWHMNKdN3tDeYyS7c9LYJ+wUXg1qeeL0xx0KfbOxWcG52mFQq 4cXVDL/7CFzDHD6zREWhJAQhmU/gqZk= Date: Fri, 20 Jan 2023 21:15:10 +0100 From: Borislav Petkov To: Michael Kelley Cc: hpa@zytor.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, 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@microsoft.com, 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, seanjc@google.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: <1673559753-94403-1-git-send-email-mikelley@microsoft.com> <1673559753-94403-7-git-send-email-mikelley@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1673559753-94403-7-git-send-email-mikelley@microsoft.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 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 Thu, Jan 12, 2023 at 01:42:25PM -0800, Michael Kelley wrote: > In a AMD SEV-SNP VM using vTOM, devices in MMIO space may be provided by > the paravisor and need to be mapped as encrypted. Provide a function > for the hypervisor to specify the address range for such devices. > In __ioremap_caller(), map addresses in this range as encrypted. > > Only a single range is supported. If multiple devices need to be > mapped encrypted, the paravisor must place them within the single > contiguous range. This already is starting to sound insufficient and hacky. And it also makes CC_ATTR_ACCESS_IOAPIC_ENCRYPTED insufficient either. So, the situation we have is, we're a SEV-SNP VM using vTOM. Which means, MSR_AMD64_SEV[3] = 1. Or SEV_FEATURES[1], alternatively - same thing. That MSR cannot be intercepted by the HV and we use it extensively in Linux when it runs as a SEV-* guest. And I had asked this before, during review, but why aren't you checking this bit above when you wanna do vTOM-specific work? Because then you can do that check and 1. map the IO-APIC encrypted 2. map MMIO space of devices from the driver encrypted too 3. ... and so on. And you won't need those other, not as nice things... Hmmm. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette