Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6019659pxb; Mon, 14 Feb 2022 13:17:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXLhaHxV4ZdwPgoFGIsGEpcuI073WEs4j8z1iXG5VjsLqzs1o/4z4zzJWxKaj2twkGzgLf X-Received: by 2002:a05:6a00:1a52:: with SMTP id h18mr813123pfv.72.1644873420094; Mon, 14 Feb 2022 13:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873420; cv=none; d=google.com; s=arc-20160816; b=K+e0YtmYDV0+FV7PTPhH8wm85RO2hwF3cakb+RGw5vac2sl3xPlJWiI8WNkBnWbdQg 2KQhy6Z1bkVV5vceSw1oOEfBtPu5/YM8lnvG8SY3hX4RHnezFg0gWOyCVw5CzAqDr97S 9aXAJ4KL+p5hZwuEpdHTIonYSRJOTkOjQ9rQlJfzK18LesiFM6cx2Aa/8eWK6V9taxL/ I3mu2N6F898gGJUr+aBM/U57kSo3NxrNcU2gbV5CbJkk1o7F3rBRZuS4BH/SM36VNEst ZqcBDoPgy7IUVJKXyCbFlrjGCX1GHoNeGqqMGYofGCNuCSC6/wYCLZwm9i3s7TNHy1XS 5TaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TZC2zqnsGdYKa6ED3IQ9bDrMCL7iNxaV9fJORDhdXXQ=; b=q3pY1/I4gb4ulcEU6mpaR4TiiywGzi0MDGt4DaDuHCs0jTtU4uQfwqO/CXCtZwI2Ed OX+ChqIPSqOLDRYAf9Y7xiYXZsHnKfWDSQ3oPCRECgFJeYpEbPVbkoMiLSM+gEcfFr9G L0IvIZx544XXEBub0vXfgqdqIzX8e3eEmv/Xe8Aa3BGDFe5i3htHd7m5vqbf+8/0eTkA MuJ3OzDPeED0gPvof7/Hs+eCu6Hk3U3dmO8SfRVU5lJxz3dMMt4YVbTQKV/DDGZYPCOz xDaLoNxvbcY0d1pPK80gY3dfsj5k2tgkSq0rePGXfqYYIi9bEo6Q7Wnt754WwAZzxp5n N5NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s68lMju5; 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=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n14si14836219plf.523.2022.02.14.13.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:17:00 -0800 (PST) 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=@linaro.org header.s=google header.b=s68lMju5; 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=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 664091A1D2D; Mon, 14 Feb 2022 12:34:59 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348928AbiBNKtQ (ORCPT + 99 others); Mon, 14 Feb 2022 05:49:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348968AbiBNKtE (ORCPT ); Mon, 14 Feb 2022 05:49:04 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB0C6BDA47 for ; Mon, 14 Feb 2022 02:11:55 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id z17so10133466plb.9 for ; Mon, 14 Feb 2022 02:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TZC2zqnsGdYKa6ED3IQ9bDrMCL7iNxaV9fJORDhdXXQ=; b=s68lMju5iEdQddCWAGgZ9FK5zw+gevcdYhSzhov5HJEUNazg4BACE2jOSbbjNAH8n8 ov/bykvpBolzaTfjrMelg9os0BIQ6zc4fjqcOJwemaUTLeQlBx+u0ZbCB9dtqEMe0Koi u1iRhdu/LIjK31Rha7+WK2zTd0fLVqmBj5egOxiVqitgVA9Z/f845dcFrYPOXGiO/0DC zaWyAQ3AmN3bGDAlRph7fyH8yqIo6ARx0/fg4ebruIc4f5KmE53x4vUCLFcTwaSY4vKe TP6B0Mm0CNydDy0bLgCLGSk1nUL8eb7D+O1pj+Dk3r2DZNyVN7EzchZ+K26LTnNpwTrR 9XVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TZC2zqnsGdYKa6ED3IQ9bDrMCL7iNxaV9fJORDhdXXQ=; b=Qh+UOk6ZGOkzQXDzmOFaclKEt+g5IzqmrYjG83uRGKwgE01+xBeTXx2fL2e/myrUSV 9NGhqposiUxdNkOGcVuq8qKiJC0AfAIdvppopGbenJ3UT/Li/qNzCZaT9dd/G7Z1fxHW yKh71VZQ16Fk8FZs5daARth4ybnJqbQ9dmVIT04wdJyC9D+o3+mHMfe+8sg/Wp0Oo5fN isEbkir1/GFfgh0nDNM/whQ6otnJ6skoIHe01iQKsoYU5rboqAwOGHED8UqgZdYHqrFv d+tnHbre9J/uXCIbLiYnalU/Eggn0Pp4HAVdgq23GbXj4PAn5PIF5zkU8PvC/7AVglJ4 koMA== X-Gm-Message-State: AOAM532zaOh7hTISXUCkac3r7z+VH6oSHBszCMYjLdVuW5wzIvuOfnxZ pQypcvrH9ecMiGU+4IxMikCb X-Received: by 2002:a17:90b:1c0e:: with SMTP id oc14mr8152443pjb.25.1644833515150; Mon, 14 Feb 2022 02:11:55 -0800 (PST) Received: from thinkpad ([2409:4072:817:5a6f:3104:62c0:1941:5033]) by smtp.gmail.com with ESMTPSA id np15sm4359544pjb.44.2022.02.14.02.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 02:11:54 -0800 (PST) Date: Mon, 14 Feb 2022 15:41:45 +0530 From: Manivannan Sadhasivam To: Lad Prabhakar Cc: Kishon Vijay Abraham I , Bjorn Helgaas , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Arnd Bergmann , Greg Kroah-Hartman , Marek Vasut , Yoshihiro Shimoda , Rob Herring , linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das Subject: Re: [RFC PATCH 4/5] misc: pci_endpoint_test: Add support to pass flags for buffer allocation Message-ID: <20220214101145.GL3494@thinkpad> References: <20220126195043.28376-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220126195043.28376-5-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220126195043.28376-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Wed, Jan 26, 2022 at 07:50:42PM +0000, Lad Prabhakar wrote: > By default GFP_KERNEL flag is used for buffer allocation in read, write > and copy test and then later mapped using streaming DMA api. But on > Renesas RZ/G2{EHMN} platforms using the default flag causes the tests to > fail. Allocating the buffers from DMA zone (using the GFP_DMA flag) make > the test cases to pass. > > To handle such case add flags as part of struct pci_endpoint_test_data > so that platforms can pass the required flags based on the requirement. > > Signed-off-by: Lad Prabhakar > --- > Hi All, > > This patch is based on the conversation where switching to streaming > DMA api causes read/write/copy tests to fail on Renesas RZ/G2 platforms > when buffers are allocated using GFP_KERNEL. > > [0] https://www.spinics.net/lists/linux-pci/msg92385.html > > Cheers, > Prabhakar > --- > drivers/misc/pci_endpoint_test.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c > index 0a00d45830e9..974546992c5e 100644 > --- a/drivers/misc/pci_endpoint_test.c > +++ b/drivers/misc/pci_endpoint_test.c > @@ -117,6 +117,7 @@ struct pci_endpoint_test { > enum pci_barno test_reg_bar; > size_t alignment; > size_t dmac_data_alignment; > + gfp_t flags; gfp_flags? Since this is used for allocation. Thanks, Mani > const char *name; > }; > > @@ -125,6 +126,7 @@ struct pci_endpoint_test_data { > size_t alignment; > int irq_type; > size_t dmac_data_alignment; > + gfp_t flags; > }; > > static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, > @@ -381,7 +383,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, > goto err; > } > > - orig_src_addr = kzalloc(size + alignment, GFP_KERNEL); > + orig_src_addr = kzalloc(size + alignment, test->flags); > if (!orig_src_addr) { > dev_err(dev, "Failed to allocate source buffer\n"); > ret = false; > @@ -414,7 +416,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, > > src_crc32 = crc32_le(~0, src_addr, size); > > - orig_dst_addr = kzalloc(size + alignment, GFP_KERNEL); > + orig_dst_addr = kzalloc(size + alignment, test->flags); > if (!orig_dst_addr) { > dev_err(dev, "Failed to allocate destination address\n"); > ret = false; > @@ -518,7 +520,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, > goto err; > } > > - orig_addr = kzalloc(size + alignment, GFP_KERNEL); > + orig_addr = kzalloc(size + alignment, test->flags); > if (!orig_addr) { > dev_err(dev, "Failed to allocate address\n"); > ret = false; > @@ -619,7 +621,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, > goto err; > } > > - orig_addr = kzalloc(size + alignment, GFP_KERNEL); > + orig_addr = kzalloc(size + alignment, test->flags); > if (!orig_addr) { > dev_err(dev, "Failed to allocate destination address\n"); > ret = false; > @@ -788,6 +790,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, > test->alignment = 0; > test->pdev = pdev; > test->irq_type = IRQ_TYPE_UNDEFINED; > + test->flags = GFP_KERNEL; > > if (no_msi) > irq_type = IRQ_TYPE_LEGACY; > @@ -799,6 +802,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, > test->alignment = data->alignment; > irq_type = data->irq_type; > test->dmac_data_alignment = data->dmac_data_alignment; > + test->flags = data->flags; > } > > init_completion(&test->irq_raised); > @@ -947,23 +951,27 @@ static const struct pci_endpoint_test_data default_data = { > .test_reg_bar = BAR_0, > .alignment = SZ_4K, > .irq_type = IRQ_TYPE_MSI, > + .flags = GFP_KERNEL, > }; > > static const struct pci_endpoint_test_data am654_data = { > .test_reg_bar = BAR_2, > .alignment = SZ_64K, > .irq_type = IRQ_TYPE_MSI, > + .flags = GFP_KERNEL, > }; > > static const struct pci_endpoint_test_data j721e_data = { > .alignment = 256, > .irq_type = IRQ_TYPE_MSI, > + .flags = GFP_KERNEL, > }; > > static const struct pci_endpoint_test_data renesas_rzg2x_data = { > .test_reg_bar = BAR_0, > .irq_type = IRQ_TYPE_MSI, > .dmac_data_alignment = 8, > + .flags = GFP_KERNEL | GFP_DMA, > }; > > static const struct pci_device_id pci_endpoint_test_tbl[] = { > -- > 2.25.1 >