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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B1781C433E0 for ; Fri, 26 Jun 2020 18:10:19 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 83AC120706 for ; Fri, 26 Jun 2020 18:10:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83AC120706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 43B1087678; Fri, 26 Jun 2020 18:10:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4qlHMFKLw6DV; Fri, 26 Jun 2020 18:10:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 8CA968764A; Fri, 26 Jun 2020 18:10:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 70214C088C; Fri, 26 Jun 2020 18:10:18 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 03B3FC016F for ; Fri, 26 Jun 2020 18:10:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CFA6422D2D for ; Fri, 26 Jun 2020 18:10:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mC960lVtCT6m for ; Fri, 26 Jun 2020 18:10:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by silver.osuosl.org (Postfix) with ESMTPS id 9B4002052C for ; Fri, 26 Jun 2020 18:10:16 +0000 (UTC) IronPort-SDR: NAzTLOrgTArY2NcdP2IjbhSa4eGCdAA2gZnIZacmebpvSwVF+uhAgdSBX6zFd1xb4q0IIMR183 RfZyz6wnAS0g== X-IronPort-AV: E=McAfee;i="6000,8403,9664"; a="230194038" X-IronPort-AV: E=Sophos;i="5.75,284,1589266800"; d="scan'208";a="230194038" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 11:10:01 -0700 IronPort-SDR: g2OBDAD4vVXNapwoCfCslq8K5czLXdJb63lCtfHN+z8y3tjb0E6UQHVMO50vSKUtUJeHklLtUf e0+2TA6XdnTQ== X-IronPort-AV: E=Sophos;i="5.75,284,1589266800"; d="scan'208";a="302408152" Received: from agluck-desk2.sc.intel.com (HELO agluck-desk2.amr.corp.intel.com) ([10.3.52.68]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 11:10:01 -0700 Date: Fri, 26 Jun 2020 11:10:00 -0700 From: "Luck, Tony" To: Peter Zijlstra Subject: Re: [PATCH v4 12/12] x86/traps: Fix up invalid PASID Message-ID: <20200626181000.GA22833@agluck-desk2.amr.corp.intel.com> References: <1593116242-31507-1-git-send-email-fenghua.yu@intel.com> <1593116242-31507-13-git-send-email-fenghua.yu@intel.com> <20200626094450.GJ4800@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200626094450.GJ4800@hirez.programming.kicks-ass.net> Cc: Fenghua Yu , Dave Jiang , Ashok Raj , Ravi V Shankar , Jean-Philippe Brucker , x86 , linux-kernel , Dave Hansen , iommu@lists.linux-foundation.org, Ingo Molnar , Borislav Petkov , Jacob Jun Pan , H Peter Anvin , Christoph Hellwig , Thomas Gleixner , David Woodhouse X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, Jun 26, 2020 at 11:44:50AM +0200, Peter Zijlstra wrote: > On Thu, Jun 25, 2020 at 01:17:22PM -0700, Fenghua Yu wrote: > > > +static bool fixup_pasid_exception(void) > > +{ > > + if (!IS_ENABLED(CONFIG_INTEL_IOMMU_SVM)) > > + return false; > > + if (!static_cpu_has(X86_FEATURE_ENQCMD)) > > + return false; > > elsewhere you had another variation: > > + if (!IS_ENABLED(CONFIG_INTEL_IOMMU_SVM)) > + return; > + > + if (!cpu_feature_enabled(X86_FEATURE_ENQCMD)) > + return; > > Which is it, and why do we need the CONFIG thing when combined with the > enabled thing? Do we have a standard way of coding for a feature that depends on multiple other features? For this case the system needs to both suport the ENQCMD instruction, and also have kernel code that programs the IOMMU. And/or guidance on when to use each of the very somewhat simlar looking boot_cpu_has() static_cpu_has() IS_ENABLED() cpu_feature_enabled() options? -Tony _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu