From nobody Mon Feb 9 06:33:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1614266772; cv=none; d=zohomail.com; s=zohoarc; b=PsApaqPjcBKTQHLfJCmZu7jHKNskLlRAcX+OdBGU3YZgMq6DMSJu59M+F8vMLI38ZZUHzh3Gq/5DNPRTlW+UpDgQi38u4neCjauVCUTZ6VECSa4piEaGmqp2jYoKBalHW3ofmKdUIRTgmzyP24/VCorQyTSTLY1lzmW+gnQkU+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614266772; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S/mJiVuOiu+vXGCosCR3Vu2+74XXXoyXUi+nuAJzkY0=; b=CLIuU3culuZ8XxgOHOMsURM2nmtmmcpQ2QnCDfPmSKzx0zUE7ymyBP29BnZNJKND2AkdtbXk6EFNhM36iDJ87cpHgLEUTfTewPoYPW30/v7tIOsKfY/mDV/YIp7CVfuXfyKMgyrvWM1Q1gUqpA+aWUu7lZ6mfxOSX5riApY60DI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1614266772542222.90067514981047; Thu, 25 Feb 2021 07:26:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.89811.169528 (Exim 4.92) (envelope-from ) id 1lFIWZ-0006L0-Do; Thu, 25 Feb 2021 15:25:55 +0000 Received: by outflank-mailman (output) from mailman id 89811.169528; Thu, 25 Feb 2021 15:25:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFIWZ-0006Kt-9u; Thu, 25 Feb 2021 15:25:55 +0000 Received: by outflank-mailman (input) for mailman id 89811; Thu, 25 Feb 2021 15:25:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFIWX-0006Ig-Tq for xen-devel@lists.xenproject.org; Thu, 25 Feb 2021 15:25:53 +0000 Received: from mail-ot1-x344.google.com (unknown [2607:f8b0:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b935c0bf-f453-4cd4-9fb3-258ed13570a3; Thu, 25 Feb 2021 15:25:49 +0000 (UTC) Received: by mail-ot1-x344.google.com with SMTP id b8so5998862oti.7 for ; Thu, 25 Feb 2021 07:25:49 -0800 (PST) Received: from localhost.localdomain (142-79-211-230.starry-inc.net. [142.79.211.230]) by smtp.gmail.com with ESMTPSA id l4sm1047292ooq.33.2021.02.25.07.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 07:25:48 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b935c0bf-f453-4cd4-9fb3-258ed13570a3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S/mJiVuOiu+vXGCosCR3Vu2+74XXXoyXUi+nuAJzkY0=; b=Pr4hzrTYQEUCle20bYISfAVaTyOqivHe99TIUf6r0gAKtH+arFGI917QdggE/Cl5kU NlpgxZzwYQonOqZ5KFq4j3vH0AaxVg/DTlPARD4hHF+LDhRuFqRSHxCveteWb+hiYUtX vKGhGMs5ypFhWkxTLmHjVKv+ZWA36KtxIL+SSYjj/+/0QTYPe0Vozrq37ftJuQedqtVG Nr+JFfy1DIpdRFMxJ6O+1VCgSEnCNwPLFqVOh2noag4MfbKB0SlQpjRirQKdfVQ05CKZ eVziQezSUddqK71HGH69I2BgA/LIbVFlpWp5FEgcedH/jUn9SlFZy5CS7FS3a7rAST+o fMpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S/mJiVuOiu+vXGCosCR3Vu2+74XXXoyXUi+nuAJzkY0=; b=VdG3fw74f/wZ0gR69PrplBF0ggZ7smWgsp6AHKKLfDV9fmHOb6IqrDsu0uvzk2Dkjw TOtBJHoB47tEjKdPhVennUMEAEOiHpFgrnTfoBIeTcV7tjsbWS7qXxJDlJxfbaFCAkn7 LC+64D1rUUaHfFx1yUQ0WstL5HsC4SK5UwjiLcUkdVxRFNEHT+pBT2lN8e5Hdsgg9UjH kgdEg2I2xKcO9OMZzFHqZggGOaKbSbOouPJDVNWhG0o2LpM2C/6LvRMXN0MNADyAU/0x tiwiUq0sQVLaZ0C436Gck025TF9m6DtNHgWV9iYk05GvpINkqtMQvZW62y9xc9VuNs2o cXPQ== X-Gm-Message-State: AOAM531fGQogkfx4IJaEZKVf6V0nKlF1ij63dbuR3CiD49iTfOevAwrz nG1tcA3Vpofid2ZgH1LVgjJ343FpqD+Q4+0z X-Google-Smtp-Source: ABdhPJxdy3b1mobNcnBRdRRS1EIkalqI25kbgmQE+6fh5/WgH2OS79LPJtpSFmgKcsKjlGur7v+ztw== X-Received: by 2002:a9d:6356:: with SMTP id y22mr2672025otk.86.1614266748601; Thu, 25 Feb 2021 07:25:48 -0800 (PST) From: Connor Davis To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Connor Davis , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH for-next 2/6] xen/common: Guard iommu symbols with CONFIG_HAS_PASSTHROUGH Date: Thu, 25 Feb 2021 08:24:01 -0700 Message-Id: <444658f690c81b9e93c2c709fa1032c049646763.1614265718.git.connojdavis@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" The variables iommu_enabled and iommu_dont_flush_iotlb are defined in drivers/passthrough/iommu.c and are referenced in common code, which causes the link to fail when !CONFIG_HAS_PASSTHROUGH. Guard references to these variables in common code so that xen builds when !CONFIG_HAS_PASSTHROUGH. Signed-off-by: Connor Davis --- xen/common/domain.c | 2 ++ xen/common/memory.c | 10 ++++++++++ xen/common/sysctl.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/xen/common/domain.c b/xen/common/domain.c index d85984638a..ad66bca325 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -501,7 +501,9 @@ static int sanitise_domain_config(struct xen_domctl_cre= atedomain *config) return -EINVAL; } =20 +#ifdef CONFIG_HAS_PASSTHROUGH if ( !iommu_enabled ) +#endif { dprintk(XENLOG_INFO, "IOMMU requested but not available\n"); return -EINVAL; diff --git a/xen/common/memory.c b/xen/common/memory.c index 76b9f58478..7135324857 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -294,7 +294,9 @@ int guest_remove_page(struct domain *d, unsigned long g= mfn) p2m_type_t p2mt; #endif mfn_t mfn; +#ifdef CONFIG_HAS_PASSTHROUGH bool *dont_flush_p, dont_flush; +#endif int rc; =20 #ifdef CONFIG_X86 @@ -385,13 +387,17 @@ int guest_remove_page(struct domain *d, unsigned long= gmfn) * Since we're likely to free the page below, we need to suspend * xenmem_add_to_physmap()'s suppressing of IOMMU TLB flushes. */ +#ifdef CONFIG_HAS_PASSTHROUGH dont_flush_p =3D &this_cpu(iommu_dont_flush_iotlb); dont_flush =3D *dont_flush_p; *dont_flush_p =3D false; +#endif =20 rc =3D guest_physmap_remove_page(d, _gfn(gmfn), mfn, 0); =20 +#ifdef CONFIG_HAS_PASSTHROUGH *dont_flush_p =3D dont_flush; +#endif =20 /* * With the lack of an IOMMU on some platforms, domains with DMA-capab= le @@ -839,11 +845,13 @@ int xenmem_add_to_physmap(struct domain *d, struct xe= n_add_to_physmap *xatp, xatp->gpfn +=3D start; xatp->size -=3D start; =20 +#ifdef CONFIG_HAS_PASSTHROUGH if ( is_iommu_enabled(d) ) { this_cpu(iommu_dont_flush_iotlb) =3D 1; extra.ppage =3D &pages[0]; } +#endif =20 while ( xatp->size > done ) { @@ -868,6 +876,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_= add_to_physmap *xatp, } } =20 +#ifdef CONFIG_HAS_PASSTHROUGH if ( is_iommu_enabled(d) ) { int ret; @@ -894,6 +903,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_= add_to_physmap *xatp, if ( unlikely(ret) && rc >=3D 0 ) rc =3D ret; } +#endif =20 return rc; } diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 3558641cd9..b4dde7bef6 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -271,12 +271,14 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u= _sysctl) pi->cpu_khz =3D cpu_khz; pi->max_mfn =3D get_upper_mfn_bound(); arch_do_physinfo(pi); +#ifdef CONFIG_HAS_PASSTHROUGH if ( iommu_enabled ) { pi->capabilities |=3D XEN_SYSCTL_PHYSCAP_directio; if ( iommu_hap_pt_share ) pi->capabilities |=3D XEN_SYSCTL_PHYSCAP_iommu_hap_pt_shar= e; } +#endif if ( vmtrace_available ) pi->capabilities |=3D XEN_SYSCTL_PHYSCAP_vmtrace; =20 --=20 2.27.0