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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74503C4361B for ; Wed, 16 Dec 2020 01:57:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EC31230FF for ; Wed, 16 Dec 2020 01:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725768AbgLPB5g (ORCPT ); Tue, 15 Dec 2020 20:57:36 -0500 Received: from mga04.intel.com ([192.55.52.120]:46638 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgLPB5f (ORCPT ); Tue, 15 Dec 2020 20:57:35 -0500 IronPort-SDR: tj621VfwVxWq66F8R1TQGLpLx0p7wX8Ucs3yf9zL+F+F9rRGAv8ihiSOvH2yzRClxi+icnkDRw 5aB50NXOa9fQ== X-IronPort-AV: E=McAfee;i="6000,8403,9836"; a="172415834" X-IronPort-AV: E=Sophos;i="5.78,423,1599548400"; d="scan'208";a="172415834" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2020 17:55:45 -0800 IronPort-SDR: Pg1VhJNtwxPPaY6JBu/qH0cJlUEndiFXtRPXSpkyQkH98HZkG9xQXfqVaR4ONNp2qL0sy0mhJx X6f+e4d/50wQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,423,1599548400"; d="scan'208";a="384064484" Received: from allen-box.sh.intel.com (HELO [10.239.159.28]) ([10.239.159.28]) by fmsmga004.fm.intel.com with ESMTP; 15 Dec 2020 17:55:39 -0800 Cc: baolu.lu@linux.intel.com, tglx@linutronix.de, ashok.raj@intel.com, kevin.tian@intel.com, dave.jiang@intel.com, megha.dey@intel.com, alex.williamson@redhat.com, bhelgaas@google.com, dan.j.williams@intel.com, dmaengine@vger.kernel.org, eric.auger@redhat.com, jacob.jun.pan@intel.com, jgg@mellanox.com, jing.lin@intel.com, kvm@vger.kernel.org, kwankhede@nvidia.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, maz@kernel.org, mona.hossain@intel.com, netanelg@mellanox.com, parav@mellanox.com, pbonzini@redhat.com, rafael@kernel.org, samuel.ortiz@intel.com, sanjay.k.kumar@intel.com, shahafs@mellanox.com, tony.luck@intel.com, vkoul@kernel.org, yan.y.zhao@linux.intel.com, yi.l.liu@intel.com Subject: Re: [RFC PATCH 1/1] platform-msi: Add platform check for subdevice irq domain To: Bjorn Helgaas References: <20201210185738.GA49060@bjorn-Precision-5520> From: Lu Baolu Message-ID: Date: Wed, 16 Dec 2020 09:48:03 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201210185738.GA49060@bjorn-Precision-5520> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Hi Bjorn, On 12/11/20 2:57 AM, Bjorn Helgaas wrote: > On Thu, Dec 10, 2020 at 08:46:24AM +0800, Lu Baolu wrote: >> The pci_subdevice_msi_create_irq_domain() should fail if the underlying >> platform is not able to support IMS (Interrupt Message Storage). Otherwise, >> the isolation of interrupt is not guaranteed. >> >> For x86, IMS is only supported on bare metal for now. We could enable it >> in the virtualization environments in the future if interrupt HYPERCALL >> domain is supported or the hardware has the capability of interrupt >> isolation for subdevices. > >> + * We want to figure out which context we are running in. But the hardware >> + * does not introduce a reliable way (instruction, CPUID leaf, MSR, whatever) >> + * which can be manipulated by the VMM to let the OS figure out where it runs. >> + * So we go with the below probably_on_bare_metal() function as a replacement >> + * for definitely_on_bare_metal() to go forward only for the very simple reason >> + * that this is the only option we have. >> + */ >> +static const char * const possible_vmm_vendor_name[] = { >> + "QEMU", "Bochs", "KVM", "Xen", "VMware", "VMW", "VMware Inc.", >> + "innotek GmbH", "Oracle Corporation", "Parallels", "BHYVE", >> + "Microsoft Corporation" >> +}; >> + >> +static bool probably_on_bare_metal(void) > > What is the point of a function called probably_on_bare_metal()? > *Probably*? The caller can't really do anything with the fact that > we're not 100% sure this gives the correct answer. Just call it > "on_bare_metal()" or something and accept the fact that it might be > wrong sometimes. Agreed. we can use on_bare_metal() and add comments and kernel messages to let users and developers know that we're not 100% sure. People should help to make it more accurate by reporting exceptions. > > This patch goes with IMS support, which somebody else is handling, so > I assume you don't need anything from the PCI side. Yes. This is a followup of previous discussion. Best regards, baolu