Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1241650lfc; Wed, 1 Jun 2022 12:49:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr1MjGZEuZXRlE+9HegQjFOq7VJpiXPlRKzIdrVx3q+7u9YNVxV63OEF5bBPL2291VD9ib X-Received: by 2002:a17:903:1212:b0:15e:7d94:e21d with SMTP id l18-20020a170903121200b0015e7d94e21dmr1072621plh.92.1654112971673; Wed, 01 Jun 2022 12:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654112971; cv=none; d=google.com; s=arc-20160816; b=xI1yzrdYPRhMU255Vf1yEkhIdmIEatxDJMVotxbIi/YMVb1X4ZWkcqxUyct4HACPKI owwhPHQqprDmOtgUFVUMK/6MLa180zcH+qlMSttOPqIpV9hpRDe4d8w4lD2eLY0U5bdJ nJKlYZT8XKytWRu+Dee1s7h39X3ewXPd19tW8X4F8H5hzQqChC/lcLnS1Y3QqpzB2bLV HEjmlNSfo+LBldazxKQu9zQH5CXVIJXtyHm8srUKd7zhYb3cFxbEwF/MmUSEO8rVsnff FBGhuMV6S8HnP15VxgKBNr0yy5bkYizRLlBe+7u2GSHskfCiLZpdv4GjHj/MK8FXNEMM 8enA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=8Id7kSzEesLTn8HeoXOUKgYcL8YgganQCWoYyexhIh8=; b=l37EGX3UiDnFel7Q+6S7EnPmS9bVCn9MGXeUIa+Jpx21sG3d9f7c/B6p5md+hhU+R+ h0omEYnz4Drjz+Zto8GvYblhXipXerRLW9m0iFJpEXKX/urZuoRBorE1LQOX5LG34B6L eNaijUN8HELWYak/HmjjI2QfcD3uYJM+gJD/mC+Ca/yD5QxZVXTAXVHrMNOhB5xpmNS8 r+BN7mky5btom5TZLrIHnU4kmi/mSrqzaoR0BmCTB9DRRzoOQhPjEeVopRToR+pOS9Dr vUYyBysUC2rE9wLjAAQlvkmakUu92M13pO+7POpXU1arYpHM+qlgCFlQk6Qupjp0F0Kv UHSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (expired) header.i=@flygoat.com; dkim=neutral (expired) header.i=@flygoat.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z128-20020a626586000000b004fac4daa16esi2881675pfb.342.2022.06.01.12.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:49:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=neutral (expired) header.i=@flygoat.com; dkim=neutral (expired) header.i=@flygoat.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B8F621EB43E; Wed, 1 Jun 2022 12:12:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352967AbiFAMVe (ORCPT + 99 others); Wed, 1 Jun 2022 08:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352853AbiFAMUw (ORCPT ); Wed, 1 Jun 2022 08:20:52 -0400 Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 888CB5002C; Wed, 1 Jun 2022 05:20:50 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id AA8665805E8; Wed, 1 Jun 2022 08:20:49 -0400 (EDT) Received: from imap44 ([10.202.2.94]) by compute4.internal (MEProxy); Wed, 01 Jun 2022 08:20:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1654086049; x= 1654093249; bh=8Id7kSzEesLTn8HeoXOUKgYcL8YgganQCWoYyexhIh8=; b=R eIvrH15ITVSpe7ZygMACwj011Ctv8P16UZFlLjNhgw1m+g8h+PzeRv05UNv1nokc Z+0NkvMK3cXlogQRC06PqslKNVhKDmu2aQF7vdGioDqBw/O0jV/JKrjJrrJWGCdy z6pFh7Cr6OrW77r/leWtnbYuu74lmIKZwk7mnsmLllU1HD+8uxnIpach/e4feq+X ZvEVe84TUW71gHWWRseo/VgteYJQGeSJ76KDa5ATf3wa+aqc1x854bO7TJEozAT3 +rJAACDT9u4fXR+BjpPk6PTJU4jNwojmYk3ES4c2tmOmCQC3nbGCKTzIvDvi/C5Y e+zBvGNOzY9fZh+zAZCzQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1654086049; x= 1654093249; bh=8Id7kSzEesLTn8HeoXOUKgYcL8YgganQCWoYyexhIh8=; b=f uUWPZTcLdhXwT4+z4XyHE0/k46rd3cql+M8PpZqE1Dw+sFpXOKhlXq8VreEQPrk2 hw8KA1Yzg5NIkwQNww48bGP7c5Ty7unaRP9jdGMk/Jk34/sLNbAirb9fGlDTdtdS BcE5n0eAzXjdKL1LnT9oO2Fg0B3iFO95jJdho36aidA37MnQYTOEGlxNlexOYI+G MNBAiguz6uRPlGZZ6rLmgovlXkk+1G2UjHvbKj4QKabIWMdlTUWi/CcK7Af2iLzD OUAh1KIBIDWhosXrXpXHwHc7tDpIofggJc9aYK3z40Ed2Uhx7xIpstr5D/Jb3yCb OXO07/yiDrZ+inQWC+3Cg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrledtgdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedflfhi rgiguhhnucgjrghnghdfuceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh eqnecuggftrfgrthhtvghrnhepudefgeeftedugeehffdtheefgfevffelfefghefhjeeu geevtefhudduvdeihefgnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrg hilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id D852C36A006F; Wed, 1 Jun 2022 08:20:48 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-591-gfe6c3a2700-fm-20220427.001-gfe6c3a27 Mime-Version: 1.0 Message-Id: In-Reply-To: <20220601100005.2989022-7-chenhuacai@loongson.cn> References: <20220601100005.2989022-1-chenhuacai@loongson.cn> <20220601100005.2989022-7-chenhuacai@loongson.cn> Date: Wed, 01 Jun 2022 13:20:28 +0100 From: "Jiaxun Yang" To: "Huacai Chen" , "Arnd Bergmann" , "Andy Lutomirski" , "Thomas Gleixner" , "Peter Zijlstra" , "Andrew Morton" , "David Airlie" , "Jonathan Corbet" , "Linus Torvalds" Cc: linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, "Xuefeng Li" , "Yanteng Si" , "Huacai Chen" , "Guo Ren" , "Xuerui Wang" , "Stephen Rothwell" , "Daniel Vetter" , dri-devel@lists.freedesktop.org, "WANG Xuerui" Subject: Re: [PATCH V12 06/24] LoongArch: Add writecombine support for drm Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 =E5=9C=A82022=E5=B9=B46=E6=9C=881=E6=97=A5=E5=85=AD=E6=9C=88 =E4=B8=8A=E5= =8D=8810:59=EF=BC=8CHuacai Chen=E5=86=99=E9=81=93=EF=BC=9A > LoongArch maintains cache coherency in hardware, but its WUC attribute > (Weak-ordered UnCached, which is similar to WC) is out of the scope of > cache coherency machanism. This means WUC can only used for write-only > memory regions. > > Cc: Daniel Vetter > Cc: dri-devel@lists.freedesktop.org > Reviewed-by: WANG Xuerui > Signed-off-by: Huacai Chen Reviewed-by: Jiaxun Yang Can still remember painful experiences on poke with WC on LS3B1500 + Pol= aris. Glad to see that WC is flawless this time. Thanks. > --- > drivers/gpu/drm/drm_vm.c | 2 +- > drivers/gpu/drm/ttm/ttm_module.c | 2 +- > include/drm/drm_cache.h | 8 ++++++++ > 3 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c > index e957d4851dc0..f024dc93939e 100644 > --- a/drivers/gpu/drm/drm_vm.c > +++ b/drivers/gpu/drm/drm_vm.c > @@ -69,7 +69,7 @@ static pgprot_t drm_io_prot(struct drm_local_map *ma= p, > pgprot_t tmp =3D vm_get_page_prot(vma->vm_flags); >=20 > #if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__)=20 > || \ > - defined(__mips__) > + defined(__mips__) || defined(__loongarch__) > if (map->type =3D=3D _DRM_REGISTERS && !(map->flags &=20 > _DRM_WRITE_COMBINING)) > tmp =3D pgprot_noncached(tmp); > else > diff --git a/drivers/gpu/drm/ttm/ttm_module.c=20 > b/drivers/gpu/drm/ttm/ttm_module.c > index a3ad7c9736ec..b3fffe7b5062 100644 > --- a/drivers/gpu/drm/ttm/ttm_module.c > +++ b/drivers/gpu/drm/ttm/ttm_module.c > @@ -74,7 +74,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching=20 > caching, pgprot_t tmp) > #endif /* CONFIG_UML */ > #endif /* __i386__ || __x86_64__ */ > #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ > - defined(__powerpc__) || defined(__mips__) > + defined(__powerpc__) || defined(__mips__) || defined(__loongarch__) > if (caching =3D=3D ttm_write_combined) > tmp =3D pgprot_writecombine(tmp); > else > diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h > index 22deb216b59c..08e0e3ffad13 100644 > --- a/include/drm/drm_cache.h > +++ b/include/drm/drm_cache.h > @@ -67,6 +67,14 @@ static inline bool drm_arch_can_wc_memory(void) > * optimization entirely for ARM and arm64. > */ > return false; > +#elif defined(CONFIG_LOONGARCH) > + /* > + * LoongArch maintains cache coherency in hardware, but its WUC=20 > attribute > + * (Weak-ordered UnCached, which is similar to WC) is out of the=20 > scope of > + * cache coherency machanism. This means WUC can only used for=20 > write-only > + * memory regions. > + */ > + return false; > #else > return true; > #endif > --=20 > 2.27.0 --=20 - Jiaxun