From patchwork Fri Feb 28 12:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11412163 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 8952E14B4 for ; Fri, 28 Feb 2020 12:27:15 +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 6F62F246AC for ; Fri, 28 Feb 2020 12:27:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F62F246AC 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 1j7eii-0000MA-Gc; Fri, 28 Feb 2020 12:26:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j7eih-0000M2-Em for xen-devel@lists.xenproject.org; Fri, 28 Feb 2020 12:26:19 +0000 X-Inumbo-ID: 853273fa-5a25-11ea-b7e8-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 853273fa-5a25-11ea-b7e8-bc764e2007e4; Fri, 28 Feb 2020 12:26:18 +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 E7B33AF77; Fri, 28 Feb 2020 12:26:17 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: Message-ID: <00a4c7ca-36a4-c108-719c-01a6e16df9b2@suse.com> Date: Fri, 28 Feb 2020 13:26:27 +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 1/5] IOMMU: iommu_intremap is x86-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" Provide a #define for other cases; it didn't seem worthwhile to me to introduce an IOMMU_INTREMAP Kconfig option at this point. Signed-off-by: Jan Beulich --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1299,6 +1299,8 @@ boolean (e.g. `iommu=no`) can override t generation of IOMMUs only supported DMA remapping, and Interrupt Remapping appeared in the second generation. + This option is not valid on Arm. + * The `intpost` boolean controls the Posted Interrupt sub-feature. In combination with APIC acceleration (VT-x APICV, SVM AVIC), the IOMMU can be configured to deliver interrupts from assigned PCI devices directly --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -35,7 +35,6 @@ bool __read_mostly iommu_quarantine = tr bool_t __read_mostly iommu_igfx = 1; bool_t __read_mostly iommu_snoop = 1; bool_t __read_mostly iommu_qinval = 1; -enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none; @@ -90,8 +89,10 @@ static int __init parse_iommu_param(cons iommu_snoop = val; else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) iommu_qinval = val; +#ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off; +#endif else if ( (val = parse_boolean("intpost", s, ss)) >= 0 ) iommu_intpost = val; #ifdef CONFIG_KEXEC @@ -474,8 +475,11 @@ int __init iommu_setup(void) rc = iommu_hardware_setup(); iommu_enabled = (rc == 0); } + +#ifndef iommu_intremap if ( !iommu_enabled ) iommu_intremap = iommu_intremap_off; +#endif if ( (force_iommu && !iommu_enabled) || (force_intremap && !iommu_intremap) ) @@ -500,7 +504,9 @@ int __init iommu_setup(void) printk(" - Dom0 mode: %s\n", iommu_hwdom_passthrough ? "Passthrough" : iommu_hwdom_strict ? "Strict" : "Relaxed"); +#ifndef iommu_intremap printk("Interrupt remapping %sabled\n", iommu_intremap ? "en" : "dis"); +#endif tasklet_init(&iommu_pt_cleanup_tasklet, iommu_free_pagetables, NULL); } @@ -558,7 +564,9 @@ void iommu_crash_shutdown(void) if ( iommu_enabled ) iommu_get_ops()->crash_shutdown(); iommu_enabled = iommu_intpost = 0; +#ifndef iommu_intremap iommu_intremap = iommu_intremap_off; +#endif } int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt) --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -27,6 +27,8 @@ const struct iommu_init_ops *__initdata iommu_init_ops; struct iommu_ops __read_mostly iommu_ops; +enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; + int __init iommu_hardware_setup(void) { struct IO_APIC_route_entry **ioapic_entries = NULL; --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -55,17 +55,20 @@ 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, iommu_igfx; extern bool_t iommu_snoop, iommu_qinval, iommu_intpost; + +#ifdef CONFIG_X86 extern enum __packed iommu_intremap { /* * In order to allow traditional boolean uses of the iommu_intremap * variable, the "off" value has to come first (yielding a value of zero). */ iommu_intremap_off, -#ifdef CONFIG_X86 iommu_intremap_restricted, -#endif iommu_intremap_full, } iommu_intremap; +#else +# define iommu_intremap false +#endif #if defined(CONFIG_IOMMU_FORCE_PT_SHARE) #define iommu_hap_pt_share true