Received: by 10.213.65.68 with SMTP id h4csp437210imn; Tue, 13 Mar 2018 09:02:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELuqjD2eMIXHlj7hA5UI9Byc9MSwt/ZNltXVs3VpJwYN7Rkxs/6f/n2rTLsMk0cSVM63urjc X-Received: by 2002:a17:902:d891:: with SMTP id b17-v6mr1022508plz.241.1520956944907; Tue, 13 Mar 2018 09:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956944; cv=none; d=google.com; s=arc-20160816; b=PGhaezC3zeuESmAarx4huBEGt9/DOX55VgVUpcsbJNELhX3bNdJqt99Ta8Zf1AWFOe 1NP9Qwt5ZOpj1iWQmFV6NbgehPjXtIuFNOmmeQjMBHwXW/o0Ic4o1QOyiPXOaaHZXdLP FlN+i/wHRLD/QrkdgsaaZ8lzEGqhZcpy3cyrF8fqG96Ai8H0ODK5h7uEPssrVXFjXZM0 PQquZPm0pKYNlfG8afnH2Rpy5CSzxgJtN+2T6u8NMsHRv33+ke0WivgRwM8SF2vammHl DsTRDUTPnvMnVpiD10KLUSNVllCVz+SG5IfxRNHWjoU+QBIKejT39YFFlT9CmAuQFT44 N9Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Oe4DBT7yidfw/ZaBFlO66nFu3W8W0WmsIqJxD+bBeEg=; b=MHypbIfPSmJvjajEszUm4zy/hrmgitLdUfUAYq4+miyzX8a69IC5BeiH/oe+VRsO/7 7I9e0L7FYHzaxWqwhnDwzxilz4AmQMIEZ03ro/GbNSQaevwrdoGup2N7slOD8XOaP5L9 FF7gfYRmb4uwGSzH8U05aJj1HDEK4jS/UhRqrAKTDIEKejiWpKfF7tVUkS6N9SL1VODM 7DDZzD1tnx3ggW18lqA/lChqI7RV/jzREpfVnCebwjnr359mFMu6FIDEramgo015476y /BWsY1WV4Ciib57A24vCLMOK38Sj0DbSJpjZIa+3TbcngS2oCr2oOMiq83feuYEuTH8i /JPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=km5NR5eg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17si275295pga.495.2018.03.13.09.02.08; Tue, 13 Mar 2018 09:02:24 -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; dkim=pass header.i=@nxp.com header.s=selector1 header.b=km5NR5eg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934550AbeCMQAH (ORCPT + 99 others); Tue, 13 Mar 2018 12:00:07 -0400 Received: from mail-eopbgr50071.outbound.protection.outlook.com ([40.107.5.71]:32256 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934427AbeCMQAC (ORCPT ); Tue, 13 Mar 2018 12:00:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Oe4DBT7yidfw/ZaBFlO66nFu3W8W0WmsIqJxD+bBeEg=; b=km5NR5egbLvTX2tw/BWnt6cS4SSuFlnjiu/RugU8xDSnPjeeOW0NcDn5VjYJQwwYuqN47UPy6YBOS8gJPe1kfnY/GpmiQiCYK5qkwXoU3YRN2ePRmr7BadB+/us3BavOmyyFG6B2L+aJQAerSYwyJi9QeSQM4rWxm/ThiziLjNU= Received: from HE1PR0401MB2425.eurprd04.prod.outlook.com (10.168.33.22) by HE1PR0401MB2425.eurprd04.prod.outlook.com (10.168.33.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Tue, 13 Mar 2018 15:59:58 +0000 Received: from HE1PR0401MB2425.eurprd04.prod.outlook.com ([fe80::a409:1898:a18e:6e85]) by HE1PR0401MB2425.eurprd04.prod.outlook.com ([fe80::a409:1898:a18e:6e85%18]) with mapi id 15.20.0588.013; Tue, 13 Mar 2018 15:59:58 +0000 From: Nipun Gupta To: Christoph Hellwig CC: "robin.murphy@arm.com" , "linux@armlinux.org.uk" , "gregkh@linuxfoundation.org" , "m.szyprowski@samsung.com" , "bhelgaas@google.com" , "dmitry.torokhov@gmail.com" , "rafael.j.wysocki@intel.com" , "jarkko.sakkinen@linux.intel.com" , "linus.walleij@linaro.org" , "johan@kernel.org" , "msuchanek@suse.de" , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "linux-pci@vger.kernel.org" Subject: RE: [PATCH] dma-mapping: move dma configuration to bus infrastructure Thread-Topic: [PATCH] dma-mapping: move dma configuration to bus infrastructure Thread-Index: AQHTup3FkFIBngAtkkaazewP28SrhqPOT3wQ Date: Tue, 13 Mar 2018 15:59:58 +0000 Message-ID: References: <1520868292-2479-1-git-send-email-nipun.gupta@nxp.com> <20180313073448.GA32269@lst.de> In-Reply-To: <20180313073448.GA32269@lst.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; x-originating-ip: [182.68.81.59] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HE1PR0401MB2425;7:mWbkekwM6tGVCoWPPoGJFIUCItvxOkDKy63tiIu51WdtEZk9W2deUu4i9+MHUc5r7kqLm81pgFytP+JCXCMaPZPBj2/2yaOPCpS0SNxYEpPnL1TNBUciF3jAbLwsL0IYxJSiV/VTBVUj+q5eHk+MR5Ot/64RgDX5LTWjA0clTrFhKokkMOzG8rZbcC6cILku0b15W4SnSwccH0+TdnPdZsFnkq74aszU+o7B6bW7S8yVh2Adu4btzb4W+HbEjA8h x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 116337b7-14e1-429d-694c-08d588fb78b0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:HE1PR0401MB2425; x-ms-traffictypediagnostic: HE1PR0401MB2425: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501244)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:HE1PR0401MB2425;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0401MB2425; x-forefront-prvs: 0610D16BBE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(396003)(346002)(39380400002)(366004)(189003)(13464003)(199004)(54906003)(5250100002)(97736004)(33656002)(66066001)(106356001)(6506007)(25786009)(316002)(6916009)(2950100002)(2900100001)(39060400002)(81166006)(81156014)(4326008)(8936002)(3846002)(6116002)(186003)(7416002)(99286004)(305945005)(7736002)(229853002)(74316002)(14454004)(68736007)(7696005)(105586002)(76176011)(3660700001)(3280700002)(6246003)(102836004)(53936002)(26005)(5660300001)(2906002)(86362001)(6436002)(478600001)(55016002)(9686003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0401MB2425;H:HE1PR0401MB2425.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: L/SnN9wrqujCxwXpcWERJ9yUtyv+pbvWKW8t0Mu/LzsKaLfTtUHwHua+i4jEEXIoCUppthCg1HDm5VYwHFE223CDKyCPlAXFdGOMPQuy0BsJb6HZ/pUAOsar3UVlFZeYPZqgtwpWuC1eKovbJYarDG6xvYS0wtei/+hp4YXxBDseLFBABln9EMk3+xLbttEyAvu544QmKMlK2ngIwsgfgx6D3hc6Rf5EFk6e98+1aI5W8FBn+Q5/u61rPNvFFeOqk4165LJzOSFkfd6vRfYDhDOk6VHBP5IRnKp7DAGIyZQd8RZPD3VLWwcm4PwjQrSUXUoH6rHxbBk4mzQfGza/XA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 116337b7-14e1-429d-694c-08d588fb78b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Mar 2018 15:59:58.4382 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2425 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Christoph Hellwig [mailto:hch@lst.de] > Sent: Tuesday, March 13, 2018 13:05 > > +int amba_dma_configure(struct device *dev) > > +{ > > + enum dev_dma_attr attr; > > + int ret =3D 0; > > + > > + if (dev->of_node) { > > + ret =3D of_dma_configure(dev, dev->of_node); > > + } else if (has_acpi_companion(dev)) { > > + attr =3D acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); > > + if (attr !=3D DEV_DMA_NOT_SUPPORTED) > > + ret =3D acpi_dma_configure(dev, attr); > > + } > > + > > + return ret; >=20 > This code sniplet is duplicated so many times that I think we should > just have some sort of dma_common_configure() for it that the various > busses can use. Agree. There is no good point in duplicating the code. So this new API will be part of 'drivers/base/dma-mapping.c' file? >=20 > > +void amba_dma_deconfigure(struct device *dev) > > +{ > > + of_dma_deconfigure(dev); > > + acpi_dma_deconfigure(dev); > > +} >=20 > As mention in my previous reply I think we don't even need a deconfigure > callback at this point - just remove the ACPI and OF wrappers and > clear the dma ops. >=20 > Also in this series we should replace the force_dma flag by use of the > proper method, e.g. give a force parameter to of_dma_configure and the > new dma_common_configure helper that the busses that want it can set. I am more inclined to what Robin states in other mail to keep symmetry. i.e. to keep dma_configure() and dma_deconfigure() and call dev->bus->dma_configure from dma_configure(). Is this okay? Thanks, Nipun