Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3195550rdb; Wed, 13 Sep 2023 05:17:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnBO8kC3f5Jo572oaqwasfQrbk87i60za07GSCdzIA2BpC2GGRgNXh/fijTpPlbJgT1ciU X-Received: by 2002:a17:90b:4ad0:b0:262:ee7d:2d20 with SMTP id mh16-20020a17090b4ad000b00262ee7d2d20mr2058242pjb.12.1694607435380; Wed, 13 Sep 2023 05:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694607435; cv=none; d=google.com; s=arc-20160816; b=xrFCVotIXsqJxzV9b/v3rako82OkQ339TvFZ/4IYrhE5wafWpJvIWPGxJ7OLFseE9W GcBflE7JsvD4l0XGYNUNaDBwjMxMk362XqlSVcpPOeP6zgkoKIgJj7k0W2k0ncwNi8wS e8ROcUQUjmetIjNy/XUrm9kXAq0ddz02TS+y5GvHg044D8s9v3WZc8RSKHIhSeswSKlE 8U1yZ5yH/1StNlNtWLerDP65nx2qpLgTIkBLbkLeVWPEpUQuVm2fzVQ26012FKQ20h9b lvM3sNxVJ62uhPpGOeYpo4MeoLoZ+lYPGP3kxKNjtS7SuyxkVxrlJOgZSz5D3XyYbWax EpnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=samJeW+hSpyZfZBSXEF7/G/NroQpOuaB8xePj8NrdKU=; fh=DIE5jbzVyknaIqNXx6A2HoRq+ADJ1W+Q+bYeTsOR24g=; b=qBskDAENBPFaX3zRWKED24g8opeG0jeWUbVVDYgEU0PrZPh2tQS8d6i1R/N4CWGJOf tozMtXjjWMsY+D2wmNNLFuLQb23Ufi49nRIveI4/HGt1n6LlTWa/XQViufqcDTjB9d2h sO5YWTzGmrMw1A/HpqVpUvfXATtgU8A82Qtn7t+d3JoStkiek4tFalKPIW4i63FZHXvU HWoIx9Ze4tfAjpkPcpXE+YStBSmBg+noo7GPzz+fpLbjto8YKXJm2FLwNsuseQyOUgsG 3zMwHNa1H0U9lwvqPSlVKa1UR3SB+ZSf1q37gZU3VycZHwCG2Ve7n1zDT2cnTC+detL7 JFtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id kb1-20020a17090ae7c100b0025c256add2bsi1511452pjb.49.2023.09.13.05.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 05:17:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E3C4F822E544; Wed, 13 Sep 2023 05:08:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240221AbjIMMI3 (ORCPT + 99 others); Wed, 13 Sep 2023 08:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235205AbjIMMI2 (ORCPT ); Wed, 13 Sep 2023 08:08:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 174FC19A7; Wed, 13 Sep 2023 05:08:24 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 08DBD1FB; Wed, 13 Sep 2023 05:09:01 -0700 (PDT) Received: from [10.57.93.239] (unknown [10.57.93.239]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A10D33F67D; Wed, 13 Sep 2023 05:08:21 -0700 (PDT) Message-ID: Date: Wed, 13 Sep 2023 13:08:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v10 1/5] staging: vc04_services: vchiq_arm: Add new bus type and device type Content-Language: en-GB To: Umang Jain , Stefan Wahren Cc: gregkh@linuxfoundation.org, f.fainelli@gmail.com, athierry@redhat.com, error27@gmail.com, kieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com, dave.stevenson@raspberrypi.com, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org References: <20230911140712.180751-1-umang.jain@ideasonboard.com> <20230911140712.180751-2-umang.jain@ideasonboard.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Sep 2023 05:08:32 -0700 (PDT) X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email On 2023-09-12 06:50, Umang Jain wrote: [...] >>> +struct vchiq_device * >>> +vchiq_device_register(struct device *parent, const char *name) >>> +{ >>> +    struct vchiq_device *device; >>> +    int ret; >>> + >>> +    device = kzalloc(sizeof(*device), GFP_KERNEL); >>> +    if (!device) { >>> +        dev_err(parent, "Cannot register %s: Insufficient memory\n", >>> +            name); >>> +        return NULL; >>> +    } >>> + >>> +    device->dev.init_name = name; >>> +    device->dev.parent = parent; >>> +    device->dev.bus = &vchiq_bus_type; >>> +    device->dev.release = vchiq_device_release; >>> + >>> +    of_dma_configure(&device->dev, parent->of_node, true); >>> +    ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); >>> +    if (ret) { >>> +        dev_err(&device->dev, "32-bit DMA enable failed\n"); >>> +        return NULL; >>> +    } >> >> Unfortunately the call of of_dma_configure() generates warnings likes >> this (Raspberry Pi 3A+ with multi_v7_defconfig + VCHIQ): >> >> [    9.206802] vchiq-bus bcm2835-audio: DMA mask not set >> [    9.206892] vchiq-bus bcm2835-camera: DMA mask not set > > huh, really weird, as on my RPi-3-b I get these set correctly and I > don't any such warning. Can you point to the code above where device->dev.dma_mask gets initialised between the initial kzalloc() and the call to of_dma_configure()? ;) BTW, bus code shouldn't be calling dma_set_mask_and_coherent() on behalf of its children, that is for the individual drivers to do, if and when they intend to actually use DMA. Removing that here will save you needing to fix the memory leak as well... Thanks, Robin.