Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp309663imm; Wed, 3 Oct 2018 16:49:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV60STNkiD3ytM8HV4C43Yz7QW9qPmMZdwbBZEbkSLFO4JOwbNCBGiYTslBgWWJR6gtQ2ps/3 X-Received: by 2002:a17:902:934c:: with SMTP id g12-v6mr3866540plp.292.1538610599052; Wed, 03 Oct 2018 16:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538610599; cv=none; d=google.com; s=arc-20160816; b=wQrExrKU8qumiM+0ErX/TEUlXCGlVTc4Jz9i8kuray0y1CPbJmZ9aa+IgoRbZqi2Nn qGOhmrdjZYWL0Mwtve6LHwfC4dlSWYaEsI0uxIrCYYW0233K0nXPHbEG6SIb08ItCBdS vvB5m3o0mOJFdJArJTLWVTYyNjSkBo30hhegcUNhPlLMzInmcosNQPZi+wTk0ovimkNk ADfPslK09YoopHMyYuvlHFtJxrBaTf6xNJiYKwiVnZUZ7M5rAhOqSA1OyOGREuc4eQZU VuG6eIHMtnxWidJrFCTbBZ0Nar7R72vmRsV9xCH1Dqg1hLniYRpbzLVc2pIQwaF0Oa8j W7Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject; bh=41i6YKOVvTs7qjOaOMbAiKlLJ6Pns/VL2sei9twi2JQ=; b=VubncZiwYLAxTgjPZwWCpENxLHqs8cwdCT7b8m6tE87Jgy51Hi2tvaRWDZ8dcD5hk6 NwH2IaAtstfezRiIPwQQrCS1aHblmluQtnjVA88h6xXSvDHB9Nmhij4xt7XkV6WtliLj bRK5bjaM6wV3wIKMtl2qIw1j2VAvOaPsnTzyZhLDj1rMqT/SEI2lCiUplJWYoSupKDJu Ud6WBsSm0n3ADaaEB7qoyAAE3orPJuupV/yTzx8yqrjhTC3HjE5nyayQD5D5mJGgd10g TB85wk5pdbNr2QiS2BUn4I/X9wwbSH30fK+PHKwxJ7W4clSjAxkIRjxEuxb1TWGVK3Vi 6jug== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si3108259plh.206.2018.10.03.16.49.41; Wed, 03 Oct 2018 16:49:59 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbeJDGio (ORCPT + 99 others); Thu, 4 Oct 2018 02:38:44 -0400 Received: from mga02.intel.com ([134.134.136.20]:23160 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbeJDGin (ORCPT ); Thu, 4 Oct 2018 02:38:43 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 16:48:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,338,1534834800"; d="scan'208";a="97224389" Received: from ahduyck-mobl.amr.corp.intel.com (HELO localhost.localdomain) ([10.7.198.152]) by orsmga002.jf.intel.com with ESMTP; 03 Oct 2018 16:48:08 -0700 Subject: [PATCH] dma-direct: Fix return value of dma_direct_supported From: Alexander Duyck To: iommu@lists.linux-foundation.org Cc: benh@kernel.crashing.org, robin.murphy@arm.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, linuxppc-dev@lists.ozlabs.org, linux@roeck-us.net Date: Wed, 03 Oct 2018 16:48:07 -0700 Message-ID: <20181003234746.3586.42014.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It appears that in commit 9d7a224b463e ("dma-direct: always allow dma mask <= physiscal memory size") the logic of the test was changed from a "<" to a ">=" however I don't see any reason for that change. I am assuming that there was some additional change planned, specifically I suspect the logic was intended to be reversed and possibly used for a return. Since that is the case I have gone ahead and done that. This addresses issues I had on my system that prevented me from booting with the above mentioned commit applied on an x86_64 system w/ Intel IOMMU. Fixes: 9d7a224b463e ("dma-direct: always allow dma mask <= physiscal memory size") Signed-off-by: Alexander Duyck --- kernel/dma/direct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 5a0806b5351b..65872f6c2e93 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -301,9 +301,7 @@ int dma_direct_supported(struct device *dev, u64 mask) min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT); - if (mask >= phys_to_dma(dev, min_mask)) - return 0; - return 1; + return mask >= phys_to_dma(dev, min_mask); } int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)