Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2354577pxb; Mon, 23 Aug 2021 19:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrWZ9JJWHgdRR+HO44pfdK2MzTWsuHxaO97zCgLnPrEw+W+7jp/c6wP9ZjhAn/d3svntOZ X-Received: by 2002:a5d:9e09:: with SMTP id h9mr18189794ioh.164.1629771333448; Mon, 23 Aug 2021 19:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629771333; cv=none; d=google.com; s=arc-20160816; b=kDlr2gsYO+4s+1Yw8AS5YPsxfOwuNCO1aJIIdkkaQNTw7/96QCyKvvyW7TopCEV2kR 9AwuQgULIr6ZG0Bnr0B+R8EqQ8N2XPAZMaIYvHP4GrLYoNuAbMfIF8iOjjI853grB+XQ FklEMbFmXmkFYqaZuB3mUEDPs4a0gOqF5jY39MbzO6G/jYTOm187TO/t7Rf8NubcJnlZ vgJDlbZxDKdDaI2K+XNhmvfnFkz4pVSwzojiDdIFbo1EGkUTNPvZ/ah4Djtxu6pcBpzk rs/ggTu5m91pYwbcL0f6Au63MXOEgAh9o8YKFuRSQxHrVC79MkqOJWfCtCwcrKpkghX+ KZ1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=lMlGUrwRTuoLohtyz8D9974Rs96PNaVff/Gdh9wAOQg=; b=ry5/0z6yjj8AS0LDSdXsSPJ0x3xVpGEB8rjPg2VdifkCisW6A/6SamU1tyQm0O+gkE LHpddtpVo9Fe5keGC6yQ8BTKSzovi3/NsbvcnoHuxQ+rB7TLM5vhNeXEmIkhumDhvSRE 3hMxUckghgu/KIwpTaLeEoBApHwXpzgEjJ1sbcviByzQMdaQQ1cPAyhZvNOfYsX7EpNf Q8fFIASeL9oA4EKzRHtxMjUktgK07Qy7ThZuQHm7qARPEBX6cEeFpG9FaOJ6EFyOw7Qh hGIgaab1mPcZ6Fmx8V+W5OvTLbFzr6tlsKC0Cogj1kI8LUsIuYEbWpR7kkhjjfBXE+g1 HX+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si20589461ioo.75.2021.08.23.19.15.21; Mon, 23 Aug 2021 19:15:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233815AbhHXCPF (ORCPT + 99 others); Mon, 23 Aug 2021 22:15:05 -0400 Received: from mga11.intel.com ([192.55.52.93]:9375 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233145AbhHXCPE (ORCPT ); Mon, 23 Aug 2021 22:15:04 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10085"; a="214093547" X-IronPort-AV: E=Sophos;i="5.84,346,1620716400"; d="scan'208";a="214093547" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2021 19:14:20 -0700 X-IronPort-AV: E=Sophos;i="5.84,346,1620716400"; d="scan'208";a="425944647" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.255.228.210]) ([10.255.228.210]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2021 19:14:19 -0700 Subject: Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range} To: Dan Williams , "Kuppuswamy, Sathyanarayanan" Cc: "Michael S. Tsirkin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Bjorn Helgaas , Richard Henderson , Thomas Bogendoerfer , James E J Bottomley , Helge Deller , "David S . Miller" , Arnd Bergmann , Jonathan Corbet , Peter H Anvin , Dave Hansen , Tony Luck , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , X86 ML , Linux Kernel Mailing List , Linux PCI , linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch , Linux Doc Mailing List , virtualization@lists.linux-foundation.org References: <20210805005218.2912076-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210805005218.2912076-12-sathyanarayanan.kuppuswamy@linux.intel.com> <20210823195409-mutt-send-email-mst@kernel.org> <26a3cce5-ddf7-cbe6-a41e-58a2aea48f78@linux.intel.com> From: Andi Kleen Message-ID: Date: Mon, 23 Aug 2021 19:14:18 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/23/2021 6:04 PM, Dan Williams wrote: > On Mon, Aug 23, 2021 at 5:31 PM Kuppuswamy, Sathyanarayanan > wrote: >> >> >> On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: >>>> Add a new variant of pci_iomap for mapping all PCI resources >>>> of a devices as shared memory with a hypervisor in a confidential >>>> guest. >>>> >>>> Signed-off-by: Andi Kleen >>>> Signed-off-by: Kuppuswamy Sathyanarayanan >>> I'm a bit puzzled by this part. So why should the guest*not* map >>> pci memory as shared? And if the answer is never (as it seems to be) >>> then why not just make regular pci_iomap DTRT? >> It is in the context of confidential guest (where VMM is un-trusted). So >> we don't want to make all PCI resource as shared. It should be allowed >> only for hardened drivers/devices. > That's confusing, isn't device authorization what keeps unaudited > drivers from loading against untrusted devices? I'm feeling like > Michael that this should be a detail that drivers need not care about > explicitly, in which case it does not need to be exported because the > detail can be buried in lower levels. We originally made it default (similar to AMD), but it during code audit we found a lot of drivers who do ioremap early outside the probe function. Since it would be difficult to change them all we made it opt-in, which ensures that only drivers that have been enabled can talk with the host at all and can't be attacked. That made the problem of hardening all these drivers a lot more practical. Currently we only really need virtio and MSI-X shared, so for changing two places in the tree you avoid a lot of headache elsewhere. Note there is still a command line option to override if you want to allow and load other drivers. -Andi