Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4410021ioa; Wed, 27 Apr 2022 03:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmK/bRY7sf2B/ofS/YfcmFZWPBZXIDLZ+xrZCzWlvjISIdm0AIN+6F199rYALo4hrVnqKx X-Received: by 2002:a63:6ac9:0:b0:3bc:321e:6d56 with SMTP id f192-20020a636ac9000000b003bc321e6d56mr3141401pgc.490.1651054658737; Wed, 27 Apr 2022 03:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651054658; cv=none; d=google.com; s=arc-20160816; b=F4id/QzTr9am0nLbVOPiYEYZZWabSbSNYnJEhTZc4evHRZtCDDTqR769RaMyL/zF28 ksDdZqQQkfFyuxLVwNUpQLMhgu21ZDH4fa1sotkuQAHF16Wuux2rQE9FiEbIXMvxiqIl x2FZ+qHupRM2uCsOSdziKzWAzk0PqrmDSQT/CDzo51Hd0ZxQpGMa7CLjWgi2CvzYEfvb GF2NhQAv2ZcmkDlgH7tYsScq9aRuxUVg1x4GcX59TasxWjTLFFm+UPJbHQarsIU1ipH9 77JCCx41ukqTHC74COl3lTZCSgEgtJHPGNOqSEIAUBxTwRBHU/MSf10PJzEjSmIt98eG DmXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OgGKsxwP7RXg4KbDkbXLrVk5SgYUe7raXh3TQhhcTdE=; b=H7/HNqRWF29U5O1Iqv+TN5t7EMGwk8mdIW/UyKNbXYuq5Jalu9fZnJkYI5DC7EvEbo ETDkfUc8u+YsSL1TSQKpjRlhVc+8GhYLyRmCrTOqUx22fP3DLYsAQHzetLDoOS20+ubE Xg7LyaLkB5uU1p1i/F17YbeW0XHe9s9Vf76J7EKbUxMR7N824CfTiL2yxNSKaKNZaHG1 lp865Q8Y4p8Dm2B0D1kpsCXm7vySoPYzZ3YIYSjlIzF64Z+mgYfsFx+caXj2eePhwMam 6NTqINdBubSI8WtpsxWxHSneZ4i+ZNmHOZOQTV/MaF1kJeefDdtkWI/7iTxf3z5TAcYx QFVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NiVnhdl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i190-20020a6387c7000000b003aa4cf898bcsi1068411pge.534.2022.04.27.03.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:17:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NiVnhdl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 36973346FDD; Wed, 27 Apr 2022 02:38:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243256AbiDZJIe (ORCPT + 99 others); Tue, 26 Apr 2022 05:08:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345764AbiDZIra (ORCPT ); Tue, 26 Apr 2022 04:47:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 271E6A76FB; Tue, 26 Apr 2022 01:37:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AE3C3B81CFA; Tue, 26 Apr 2022 08:37:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B769C385A0; Tue, 26 Apr 2022 08:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962261; bh=jFm8Koe9x0fNpJvJozkZL3Fjf/sZ/Xq/QG5v5NdJk2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NiVnhdl66aFSCoTogcV1sAhXCMyXdu8DQ7cU95KdE9zeJej5T9huth6otwgd4/jM5 6UfhGYps6FNIxSPfaGlzgWAoHfqpoRUN0jaImKmMB0nOIM2pmsBiSfY1cLAHs/RaU3 hM6hZWuIGt1TZIp1695JUKCxawPD58akJK2Tlp7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Rapoport , Christoph Hellwig , David Hildenbrand , Will Deacon , Georgi Djakov Subject: [PATCH 5.15 006/124] dma-mapping: remove bogus test for pfn_valid from dma_map_resource Date: Tue, 26 Apr 2022 10:20:07 +0200 Message-Id: <20220426081747.474819433@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport commit a9c38c5d267cb94871dfa2de5539c92025c855d7 upstream. dma_map_resource() uses pfn_valid() to ensure the range is not RAM. However, pfn_valid() only checks for availability of the memory map for a PFN but it does not ensure that the PFN is actually backed by RAM. As dma_map_resource() is the only method in DMA mapping APIs that has this check, simply drop the pfn_valid() test from dma_map_resource(). Link: https://lore.kernel.org/all/20210824173741.GC623@arm.com/ Signed-off-by: Mike Rapoport Reviewed-by: Christoph Hellwig Acked-by: David Hildenbrand Link: https://lore.kernel.org/r/20210930013039.11260-2-rppt@kernel.org Signed-off-by: Will Deacon Fixes: 859a85ddf90e ("mm: remove pfn_valid_within() and CONFIG_HOLES_IN_ZONE") Link: https://lore.kernel.org/r/Yl0IZWT2nsiYtqBT@linux.ibm.com Signed-off-by: Georgi Djakov Signed-off-by: Greg Kroah-Hartman --- kernel/dma/mapping.c | 4 ---- 1 file changed, 4 deletions(-) --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -296,10 +296,6 @@ dma_addr_t dma_map_resource(struct devic if (WARN_ON_ONCE(!dev->dma_mask)) return DMA_MAPPING_ERROR; - /* Don't allow RAM to be mapped */ - if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr)))) - return DMA_MAPPING_ERROR; - if (dma_map_direct(dev, ops)) addr = dma_direct_map_resource(dev, phys_addr, size, dir, attrs); else if (ops->map_resource)