Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1131461rwd; Wed, 31 May 2023 09:50:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4IrlJdmjxxXzz3C0tqle6yJSgHObCFusZ0Rzi0TrpCGTdi+gm/UO9aqoOj94Z3CPUHChTd X-Received: by 2002:a05:6a20:4423:b0:106:92a:37ae with SMTP id ce35-20020a056a20442300b00106092a37aemr13276825pzb.30.1685551831398; Wed, 31 May 2023 09:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685551831; cv=none; d=google.com; s=arc-20160816; b=EffQNGLWC5Qz8E534sQSghg6BDE9ZFkLwmI7cm6ABb4JN68Xg9grmRJ5584omKkEG7 e79kKKkoJg7lZwk8Fgt7q6JWvWNoOSBRlr46CnM/2cldPtje9I1L1G37XrcMbhtof0Fd 19ACNWolF+rz46Y3EVO0mdumf39gxBLgulyk1Q53d6PIYL8sIJhFwZZ3Ht/5nLy4BG2n 0xaycbpfue+p0VgHQckD473z9UBeRCgUYg6jTmw8TYr0ZyM/RPQygTRkpgui92sfTSwQ NUcyrBKngkfKbJ8s1MXJ6E0qdpCXTVq/4gfJv8Ky0vqEQy0ZcNllTI5BTorLzkgpjJ9s 7QBQ== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=0xZzYn1LIQeuOzXcSSkbfVGIqcdRcynAqvgg/O0tcLg=; b=eS5BqWIR0If8ckBtU5GdsyEdUepS8sTFLkyZ4DmtgmcKJifBKY+yU+HlkMT5dB7RJK DeKnDf9U6aT9wU2sYoJkUhCsZvrBHA5WNbtcnHJ1oPvagU1FE3pqOdIcPK4h98mntsFo vefUhrYjArWcbiYmPPs+siuAUvwOXEnAbCEetYxwFUylUB0PIFZ/6ssfO+LrQrXZSlw5 W249cAPY1pJN1HPoEBxnfctm/FqzLw7CxRt5RCCTsSNKxB8Es5/T8b4W4N0WIFrxoJ7Y cYAzG2G/jQY/P1E/2fdEFtiIngNO4jyOlq7FgKunHAak71QhXj1ztOlVAdPEQpVITTGJ pu/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i189-20020a6387c6000000b0051b5fc497e9si1220990pge.739.2023.05.31.09.50.13; Wed, 31 May 2023 09:50:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbjEaQdB (ORCPT + 99 others); Wed, 31 May 2023 12:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjEaQdA (ORCPT ); Wed, 31 May 2023 12:33:00 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4869B123 for ; Wed, 31 May 2023 09:32:57 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8AxBvG4dndkcwQDAA--.6821S3; Thu, 01 Jun 2023 00:32:56 +0800 (CST) Received: from [10.20.42.43] (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxddG3dndkiaOCAA--.14887S3; Thu, 01 Jun 2023 00:32:55 +0800 (CST) Message-ID: <6668b162-5de1-8b2e-06d3-577f098e6ed4@loongson.cn> Date: Thu, 1 Jun 2023 00:32:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v6 5/6] drm/etnaviv: add driver support for the PCI devices Content-Language: en-US To: Lucas Stach , Bjorn Helgaas Cc: Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, loongson-kernel@lists.loongnix.cn, Li Yi References: <950fdaaa-b62c-7f36-a499-9eca71c8bc47@loongson.cn> <5e0b34054ca6fa540e481d93f3c1d9fbdd2defcd.camel@pengutronix.de> From: Sui Jingfeng Organization: Loongson In-Reply-To: <5e0b34054ca6fa540e481d93f3c1d9fbdd2defcd.camel@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf8DxddG3dndkiaOCAA--.14887S3 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJFyxtw13WF4DGr1UJFy5urg_yoW5GF18pF Wa9a1SyF4vgr1Fyw17tw45XF1ay3yftFy5Jrn8tF1kCr90v343Gr1rtr4Y9F9xur1xGa12 vay2kFW29Fn8CaDanT9S1TB71UUUUjUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bDAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26r4j6F4UM28EF7xvwVC2z280aVCY1x0267AKxVW8JVW8Jr1ln4kS 14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv 67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07 AlzVAYIcxG8wCY1x0262kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE 7xkEbVWUJVW8JwCFI7km07C267AKxVWUtVW8ZwC20s026c02F40E14v26r1j6r18MI8I3I 0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAI cVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcV CF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jzE_NUUUUU= X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi, On 2023/6/1 00:23, Lucas Stach wrote: > Hi Sui Jingfeng, > > Am Donnerstag, dem 01.06.2023 um 00:08 +0800 schrieb Sui Jingfeng: >> Hi, >> >> On 2023/5/31 03:02, Bjorn Helgaas wrote: >>> On Wed, May 31, 2023 at 12:06:42AM +0800, Sui Jingfeng wrote: >>>> This patch adds PCI driver support on top of what already have. Take the >>>> GC1000 in LS7A1000/LS2K1000 as the first instance of the PCI device driver. >>>> There is only one GPU core for the GC1000 in the LS7A1000 and LS2K1000. >>>> Therefore, component frameworks can be avoided. Because we want to bind the >>>> DRM driver service to the PCI driver manually. >>>> + * Loongson Mips and LoongArch CPU(ls3a5000, ls3a4000, ls2k1000la) >>>> + * maintain cache coherency by hardware >>>> + */ >>>> + if (IS_ENABLED(CONFIG_CPU_LOONGSON64) || IS_ENABLED(CONFIG_LOONGARCH)) >>>> + priv->has_cached_coherent = true; >>> This looks like something that should be a runtime check, not a >>> compile-time check. >>> >>> If it's possible to build a single kernel image that runs on Loongson >>> MIPS or LoongArch CPU and, in addition, runs on other platforms, you >>> cannot assume that all the others maintain this cache coherency. >> Nice catch! I don't even realize this! >> >> >> LS3A4000 is mips64r2 with MSA SIMD, while LS3A5000 is LoongArch, >> >> instruction set, compiler, and binary interface are totally changed. >> >> Therefore, it's impossible to build a single kernel image that runs on >> all Loongson CPUs. >> >> Currently, I can guarantee that this works on the Loongson platform. >> >> My initial intent here is to let priv->has_cached_coherent be *true* on >> the Loongson platform (both mips and loongarch). >> >> I do know there are some other vendors who bought GPU IP from Vivante. >> >> say GC7000, and integrate it into their discrete GPU product. >> >> But it is also a PCI device, but this is another story; it deserves >> another patch. >> >> I don't know if Etnaviv folk find some similar hardware on Arm Arch, >> >> Some Arm CPUs do not maintain cached coherency on hardware. >> >> The has_cached_coherent member can be set to false on such hardware. >> >> For us, it seems that there is no need to do runtime checking, >> >> because they are all cached coherent by default. >> >> >> Can I improve this in the future, currently I don't have a good idea. > I think I mentioned before that this needs to be a runtime check. What > does dev_is_dma_coherent() return for the Vivante GPU device on your > platform? Yes, you have told me so. I will try it, and I will answer your question tomorrow. > Regards, > Lucas -- Jingfeng