Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3565815rdb; Wed, 13 Sep 2023 16:38:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7uAeXTMeElE80vPCk9cbJOsShMK4cQSBSwHYdrtD9IIM+bkRMjHy0keDY9JNKoqXlPw4B X-Received: by 2002:a05:6358:52d4:b0:134:c785:5932 with SMTP id z20-20020a05635852d400b00134c7855932mr4543490rwz.32.1694648310930; Wed, 13 Sep 2023 16:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694648310; cv=none; d=google.com; s=arc-20160816; b=Zj7LPACgnpFuAlBWfEamkbHg1lhBHPnpbNYxU+zOEBm8cXMQ5zhfjSjEoYyg6p2Oip pXX7jB4HahUM5HgZnn5dc/UQwt3zXqG817+BvON0nQo+GEHAXvEq4odG+SQt2QN1dc4e Jw/HvZy7C1iXmUjqkaELpQFYgRBD3FTy6f/FcfyZ7VyfSUOC7SCN7dicZpb2lzFLS+ji dYTx4rENC78KTxpodrxfrDeVXimlGpg0Sg8P/VAJjjFnVbBGPI+SmOa0y+np/lOlAlxC qVmFZ1p8UnlVAMMR2POnPjfRbnV0/wLxRVJWtmkC07EZ3We55eAiqz3SvSkM2BcTQDiE v3MQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=UJLiZ2kWl60EAt19DZgjkMf8f2eSOsAcEm0dyLHhVAw=; fh=c0D3XE9G3pNYAbb44bS8CxT+9w5j3Jzo5UKNUfil2Go=; b=MGKAVb/AeE5srKZgH40rcRaDsHzgHyqo1Ouol7Mtuod2ZCBh/wJegk4psP7DAVQa/2 ZEEF6LV9brEmN1R4qf0Q9aAY86zv29Lt6LrrHS5AdVwNQOZxsm5rg9HGUcqm96uBUKQJ QimYu+Q6GhLWSa7pGQW41xN7Zdi+Pa8dJNSzv2b7tj/QJtn8KXKCxOtelTA2OlNKL308 opMjh7VjpaDIxThNbFSUuRtOoPJwzDz3rGZVYcaKg2wrvMX0bD+Kn39zo8mzmoQc186Q DHHevKCye+6HEq27t2HqW5BZ24Hd8FrcUuENb5TQ6QwwkZctZrHzsTFJOyOVOnRhwNDQ mGsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nWQubWVH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m9-20020a654389000000b00565ecd01399si185965pgp.783.2023.09.13.16.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 16:38:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nWQubWVH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 153148303A04; Wed, 13 Sep 2023 12:29:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232512AbjIMT3Y (ORCPT + 99 others); Wed, 13 Sep 2023 15:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbjIMT3N (ORCPT ); Wed, 13 Sep 2023 15:29:13 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A214D19A0; Wed, 13 Sep 2023 12:29:09 -0700 (PDT) Received: from [192.168.1.110] (unknown [103.86.18.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2B5FB72E; Wed, 13 Sep 2023 21:27:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694633255; bh=2PEdmZJVlkIWAZzcOdmGLDTCygP7cmTZ3CudbNNyMNU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=nWQubWVHMeD45QxffS4RL2R2BLxbLOzXQZoW3tmGE9C0iknhslbVvGmY0UBW1wCxT Ckyleni/lqSxJ4xUm6mKc2EPvIR0R07FWiCoOR26Oa1PsRI7L3/R50n07HRH+34C2K pHK+IazdsKq2Mu+5tsigKnCOmfNogzhe/vmJMfQg= Message-ID: Date: Thu, 14 Sep 2023 00:59:00 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v10 1/5] staging: vc04_services: vchiq_arm: Add new bus type and device type To: Robin Murphy , 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> Content-Language: en-US From: Umang Jain 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 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 12:29:32 -0700 (PDT) X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 groat.vger.email Hi Robin On 9/13/23 5:38 PM, Robin Murphy wrote: > 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 for this suggestion. I have now set the dma_mask within the child itself! > > Thanks, > Robin.