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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 1817BC433E0 for ; Fri, 26 Jun 2020 18:16:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE095207D8 for ; Fri, 26 Jun 2020 18:15:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="WGHo01Ni" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726175AbgFZSP7 (ORCPT ); Fri, 26 Jun 2020 14:15:59 -0400 Received: from mail.skyhub.de ([5.9.137.197]:43220 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725780AbgFZSP6 (ORCPT ); Fri, 26 Jun 2020 14:15:58 -0400 Received: from zn.tnic (p200300ec2f0d1400d99b017616e7d256.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:1400:d99b:176:16e7:d256]) (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 B3DFC1EC0136; Fri, 26 Jun 2020 20:15:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1593195355; 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=K2CJIk9iowgPaK93YLqKtsoeAarMKRZRNRyX9xlsHGw=; b=WGHo01Ni5a9EIBQZ8DoOJEDy11rUkc5B8Y8CS9BQdGp+nQRYe0awSHaWwqqB53p0mxhFJM Lsu/rM53eHDAw34OJQ2FJBVzuq+UQ08aKNwsMIH3mQ8f4RCdkPuxMLHiDGSh0WFqFtYYT6 HOzMGAZzedykl06V0+IwBKAKwAbZLu8= Date: Fri, 26 Jun 2020 20:15:50 +0200 From: Borislav Petkov To: "Luck, Tony" Cc: Peter Zijlstra , Fenghua Yu , Thomas Gleixner , Joerg Roedel , Ingo Molnar , H Peter Anvin , David Woodhouse , Lu Baolu , Dave Hansen , Jean-Philippe Brucker , Christoph Hellwig , Ashok Raj , Jacob Jun Pan , Dave Jiang , Sohil Mehta , Ravi V Shankar , linux-kernel , x86 , iommu@lists.linux-foundation.org Subject: Re: [PATCH v4 12/12] x86/traps: Fix up invalid PASID Message-ID: <20200626181550.GF27151@zn.tnic> 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> <20200626181000.GA22833@agluck-desk2.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200626181000.GA22833@agluck-desk2.amr.corp.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 11:10:00AM -0700, Luck, Tony wrote: > 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. Yes, you need both. Consider distros enabling everything so that they can ship a single kernel image. > And/or guidance on when to use each of the very somewhat simlar looking > boot_cpu_has() > static_cpu_has() See the comment over _static_cpu_has() in arch/x86/include/asm/cpufeature.h In the exception path you should use the static_ variant. > IS_ENABLED() This is testing CONFIG_ settings, i.e., build time. > cpu_feature_enabled() This too, indirectly. See arch/x86/include/asm/disabled-features.h -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette