Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp960656imu; Wed, 23 Jan 2019 08:33:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN4wyAvCtm5ojmS5PNpbpA3jmVV4c4jVCLDLJYeZ5tpll+tBWJJaMNEtgS7bzLr3sh8A+IFV X-Received: by 2002:a62:5003:: with SMTP id e3mr2665609pfb.23.1548261199800; Wed, 23 Jan 2019 08:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548261199; cv=none; d=google.com; s=arc-20160816; b=qm79qukH1TjbG5x8ADBI11CXDYOOuJyPdZk8lJXrj/ZpkttC/LrRIoUVG2uimc+zOJ pYmJQmDUNGOkfgTecQNwp2RE54YVNkDz2JkjeFY5P+y3hA69WvXr1/PBEJIQuZzAQ3Da FrPr2KQy8uja/hVhj/afkh0qb9sY4PeiRIr9hrelTw/9CR21e6r1PqfM5GwCsSy1eHH8 4sqdXfZWHOmci6trSjSDAHq+VesSi/pcP1EpqDO9oK++Pt2GQhYdP94/Ud0mwJWUSHFe cBi7iZQmJmG+GnV2V0osyp4aTwUQg2JJ38vvMO/R7Xn4wUIG+/s9VdosAXrbXRFbVve0 00aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=qSKa4ZL/GrU9CKmPRRe1KPmMvLISKUH+j7fT4txB3g0=; b=Hrx5KzKs7IXiUQkjBT2JBOeeFe5j7qCMbiIlgmeB8N7rwgcw4aHrdVGxDv0JvQDhMu CIn5iEdbA0EmZ8QyM17y9qAyGD4WEdjlE3BTUJP8qfiqK/G1+9P18Zrbcfm1sx/qa8oh WscKXHfUuvnVSXsvGNBgqde11sF4kQ0BHvwOSdrRTUQw1yUGJlv4nMlzpvSDsIjkPRTz zimEVFUHVLRyxWd+MSJn0DqfQL7Nys+VSnYtyxX79TFxR6oajS/GsF2SrgDFbBWti7af osvqNQvNDR/IV+QATUa6/FcigQ9eDHJRaVgja6j3u0qnloichhYhnckfIOQUUz7yUDGd 5hMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si18911918pfk.210.2019.01.23.08.33.04; Wed, 23 Jan 2019 08:33:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726197AbfAWQbQ (ORCPT + 99 others); Wed, 23 Jan 2019 11:31:16 -0500 Received: from 8bytes.org ([81.169.241.247]:59196 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbfAWQax (ORCPT ); Wed, 23 Jan 2019 11:30:53 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 6761243A; Wed, 23 Jan 2019 17:30:51 +0100 (CET) From: Joerg Roedel To: "Michael S . Tsirkin" , Jason Wang , Konrad Rzeszutek Wilk , Christoph Hellwig Cc: Jens Axboe , virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, jfehlig@suse.com, jon.grimm@amd.com, brijesh.singh@amd.com, joro@8bytes.org, jroedel@suse.de Subject: [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Date: Wed, 23 Jan 2019 17:30:46 +0100 Message-Id: <20190123163049.24863-3-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190123163049.24863-1-joro@8bytes.org> References: <20190123163049.24863-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel This function will be used from dma_direct code to determine the maximum segment size of a dma mapping. Signed-off-by: Joerg Roedel --- include/linux/swiotlb.h | 6 ++++++ kernel/dma/swiotlb.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index ceb623321f38..5c087d330b4b 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -63,6 +63,7 @@ extern void swiotlb_tbl_sync_single(struct device *hwdev, extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); extern size_t swiotlb_max_mapping_size(struct device *dev); +bool is_swiotlb_active(void); #ifdef CONFIG_SWIOTLB extern enum swiotlb_force swiotlb_force; @@ -100,6 +101,11 @@ static inline size_t swiotlb_max_mapping_size(struct device *dev) { return SIZE_MAX; } + +static inline bool is_swiotlb_active(void) +{ + return false; +} #endif /* CONFIG_SWIOTLB */ extern void swiotlb_print_info(void); diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 9cb21259cb0b..9fbd075081d9 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -667,3 +667,8 @@ size_t swiotlb_max_mapping_size(struct device *dev) { return ((size_t)1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE; } + +bool is_swiotlb_active(void) +{ + return !no_iotlb_memory; +} -- 2.17.1