From patchwork Fri Feb 28 12:27:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11412171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C7761395 for ; Fri, 28 Feb 2020 12:28:20 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 62EAE246AC for ; Fri, 28 Feb 2020 12:28:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62EAE246AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j7ejl-0000bQ-Ss; Fri, 28 Feb 2020 12:27:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j7ejl-0000bA-9k for xen-devel@lists.xenproject.org; Fri, 28 Feb 2020 12:27:25 +0000 X-Inumbo-ID: ac70ccf0-5a25-11ea-991c-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ac70ccf0-5a25-11ea-991c-12813bfff9fa; Fri, 28 Feb 2020 12:27:24 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A1FF4AF33; Fri, 28 Feb 2020 12:27:23 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: Message-ID: Date: Fri, 28 Feb 2020 13:27:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Subject: [Xen-devel] [PATCH 5/5] IOMMU: iommu_snoop is x86/HVM-only X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Wilk , George Dunlap , Andrew Cooper , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In fact it's VT-d specific, but we don't have a way yet to build code for just one vendor. Provide a #define for all other cases. Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -32,7 +32,6 @@ bool_t __read_mostly iommu_enabled; bool_t __read_mostly force_iommu; bool_t __read_mostly iommu_verbose; bool __read_mostly iommu_quarantine = true; -bool_t __read_mostly iommu_snoop = 1; bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none; @@ -79,8 +78,10 @@ static int __init parse_iommu_param(cons #endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; +#ifndef iommu_snoop else if ( (val = parse_boolean("snoop", s, ss)) >= 0 ) iommu_snoop = val; +#endif #ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off; @@ -488,7 +489,9 @@ int __init iommu_setup(void) printk("I/O virtualisation %sabled\n", iommu_enabled ? "en" : "dis"); if ( !iommu_enabled ) { - iommu_snoop = 0; +#ifndef iommu_snoop + iommu_snoop = false; +#endif iommu_hwdom_passthrough = false; iommu_hwdom_strict = false; } --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -52,6 +52,9 @@ bool __read_mostly untrusted_msi; bool __read_mostly iommu_igfx = true; bool __read_mostly iommu_qinval = true; +#ifndef iommu_snoop +bool __read_mostly iommu_snoop = true; +#endif int nr_iommus; @@ -2288,8 +2291,10 @@ static int __init vtd_setup(void) cap_sps_2mb(iommu->cap) ? ", 2MB" : "", cap_sps_1gb(iommu->cap) ? ", 1GB" : ""); +#ifndef iommu_snoop if ( iommu_snoop && !ecap_snp_ctl(iommu->ecap) ) - iommu_snoop = 0; + iommu_snoop = false; +#endif if ( iommu_hwdom_passthrough && !ecap_pass_thru(iommu->ecap) ) iommu_hwdom_passthrough = false; @@ -2331,7 +2336,9 @@ static int __init vtd_setup(void) } #define P(p,s) printk("Intel VT-d %s %senabled.\n", s, (p)? "" : "not ") +#ifndef iommu_snoop P(iommu_snoop, "Snoop Control"); +#endif P(iommu_hwdom_passthrough, "Dom0 DMA Passthrough"); P(iommu_qinval, "Queued Invalidation"); P(iommu_intremap, "Interrupt Remapping"); @@ -2351,7 +2358,9 @@ static int __init vtd_setup(void) error: iommu_enabled = 0; - iommu_snoop = 0; +#ifndef iommu_snoop + iommu_snoop = false; +#endif iommu_hwdom_passthrough = false; iommu_qinval = 0; iommu_intremap = iommu_intremap_off; --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -54,7 +54,6 @@ static inline bool_t dfn_eq(dfn_t x, dfn extern bool_t iommu_enable, iommu_enabled; extern bool force_iommu, iommu_quarantine, iommu_verbose; -extern bool_t iommu_snoop; #ifdef CONFIG_X86 extern enum __packed iommu_intremap { @@ -72,9 +71,10 @@ extern bool iommu_igfx, iommu_qinval; #endif #if defined(CONFIG_X86) && defined(CONFIG_HVM) -extern bool iommu_intpost; +extern bool iommu_intpost, iommu_snoop; #else # define iommu_intpost false +# define iommu_snoop false #endif #if defined(CONFIG_IOMMU_FORCE_PT_SHARE)