Received: by 10.223.185.111 with SMTP id b44csp1669803wrg; Sat, 10 Mar 2018 11:06:01 -0800 (PST) X-Google-Smtp-Source: AG47ELsZ5FtuVrLoarGuRkTA2iB15WxxCIxJnoAGMiLNy1rHyLu2NjQxzbh8qK+DNTisb5P4Jjm5 X-Received: by 2002:a17:902:26a:: with SMTP id 97-v6mr2812133plc.3.1520708761549; Sat, 10 Mar 2018 11:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520708761; cv=none; d=google.com; s=arc-20160816; b=lN1gqiD3EZUhQTSmYnLLKeGDkOHMyWVkHyeqF9ZDS4fTSw/FYzN+OeqneZ1MPUF2na Gv+DY15qowQDdobLK1p3K0BvwanOY3AeQg4HiyspqG3RCcJ9qviqSS4F1y6RVa7E+ahF wWU1SXpeT/JEDwfLrSeTW1PR/NiEslifDkA4/+47/ncSzW+w1xvT+0v2Qhjwib3KlBup 0+uW64mIhhnQiyhGO6DckZGO98FG2c0LXuS2S1Nwf07KSs6igkuGhzLDKoURjVWNKU9k 0xUt0jfRDL/Vxw23lKjrxCxIEdKJ/yY2NeMU8ZPgGsmxurujXsr4kYFkFq001boz5TUm jc7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=gNpiD4jK5M/Uqm59bGtiNGtsc9f8O/e20Z6Vl9WSLKc=; b=fBIGNDtm8v1RDHUjypm6bZ22jjEDIkXYk0epEojmM+NiphX9g1PnQsjj9dplKTexnZ wGM7jjrCAsxKL1UDECd5R8XKutxGv3/qIgMiKG9ghN80zY7VV04lNC5QW9COMbWdHi9n GMZWPL17GU2XDb8RjS6V0dMBZv4BsIm0iXjhvDEIu+G0NOODdcCSlDnkboMl32EsHJQJ 7/he5tOfbRJRR0AB7YSxiSYQ+ctVeUgfF9yXpzP5inf7ditgSqFMj48pemJrD2sQNwza 9D+l+N5mhRtZJqa7zdzRU25Jo5v5vE7X9f9TosBa6feiIqStmVXVUNjJy5EDxqaBi9HL RUlQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si2692892pga.52.2018.03.10.11.05.37; Sat, 10 Mar 2018 11:06:01 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751224AbeCJTEJ (ORCPT + 99 others); Sat, 10 Mar 2018 14:04:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:47476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbeCJTEI (ORCPT ); Sat, 10 Mar 2018 14:04:08 -0500 Received: from mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 76CDA2178C; Sat, 10 Mar 2018 19:04:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76CDA2178C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mcgrof@kernel.org Received: by mail-io0-f175.google.com with SMTP id v10so425684iob.6; Sat, 10 Mar 2018 11:04:07 -0800 (PST) X-Gm-Message-State: AElRT7GgUAy8jbZ1Ig7b7iFqwYPu5YbXeWZbK6MnPi7cFZkdJwM9buG3 H4Q0PzRts240dJrvjGjwi6i/+CvKGpD2i3W6bqY= X-Received: by 10.107.17.39 with SMTP id z39mr3193466ioi.274.1520708646816; Sat, 10 Mar 2018 11:04:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.10.83 with HTTP; Sat, 10 Mar 2018 11:03:45 -0800 (PST) In-Reply-To: References: <20180301171936.GU14069@wotan.suse.de> <20180307190205.GA14069@wotan.suse.de> <20180308040601.GQ14069@wotan.suse.de> <20180308041411.GR14069@wotan.suse.de> From: "Luis R. Rodriguez" Date: Sat, 10 Mar 2018 11:03:45 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: ivtv: use arch_phys_wc_add() and require PAT disabled To: "French, Nicholas A." Cc: Andy Lutomirski , "hans.verkuil@cisco.com" , "linux-kernel@vger.kernel.org" , "linux-media@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 10, 2018 at 8:57 AM, French, Nicholas A. wrote: > On Wed, Mar 07, 2018 at 11:23:09PM -0600, French, Nicholas A. wrote: >> On Thu, Mar 08, 2018 at 04:14:11AM +0000, Luis R. Rodriguez wrote: >> > On Thu, Mar 08, 2018 at 04:06:01AM +0000, Luis R. Rodriguez wrote: >> > > On Thu, Mar 08, 2018 at 03:16:29AM +0000, French, Nicholas A. wrote: >> > > > >> > > > Ah, I see. So my proposed ioremap_wc call was only "working" by aliasing the >> > > > ioremap_nocache()'d mem area and not actually using write combining at all. >> > > >> > > There are some debugging PAT toys out there I think but I haven't played with >> > > them yet or I forgot how to to confirm or deny this sort of effort, but >> > > likeley. >> > >> > In fact come to think of it I believe some neurons are telling me that if >> > two type does not match we'd get an error? > > I can confirm that my original suggested patch just aliases to ivtv-driver's nocache mapping: > $ sudo modprobe ivtvfb > $ sudo dmesg > ... > x86/PAT: Overlap at 0xd5000000-0xd5800000 > x86/PAT: reserve_memtype added [mem 0xd5510000-0xd56b0fff], track uncached-minus, req write-combining, ret uncached-minus > ivtvfb0: Framebuffer at 0xd5510000, mapped to 0x00000000c6a7ed52, size 1665k > ... > $ sudo cat /sys/kernel/debug/x86/pat_memtype_list | grep 0xd5 > uncached-minus @ 0xd5000000-0xd5800000 > uncached-minus @ 0xd5510000-0xd56b1000 > > So nix that. > >> > No what if the framebuffer driver is just requested as a secondary step >> > after firmware loading? >> >> Its a possibility. The decoder firmware gets loaded at the beginning of the decoder >> memory range and we know its length, so its possible to ioremap_nocache enough >> room for the firmware only on init and then ioremap the remaining non-firmware >> decoder memory areas appropriately after the firmware load succeeds... > > I looked in more detail, and this would be "hard" due to the way the rest of the > decoder offsets are determined by either making firmware calls or scanning the > decoder memory range for magic bytes and other mess. > > I think some smart guy named mcgrof apparently came to the same conclusion > in a really old email chain I found [https://lists.gt.net/linux/kernel/2387536]: > "The ivtv case is the *worst* example we can expect where the firmware > hides from us the exact ranges for write-combining, that we should somehow > just hope no one will ever do again." > :-) This is tribal knowledge worth formalizing a bit more for the long run for this ivtv driver. >> Perhaps the easy answer is to change the fatal is-pat-enabled check to just a >> warning like "you have PAT enabled, so wc is disabled for the framebuffer. >> if you want wc, use the nopat parameter"? > > I like this idea more and more. I haven't experience any problems running > with PAT-enabled and no write-combining on the framebuffer. Any objections? I think its worth it, and perhaps best folded under a new kernel parameter option which also documents the limitation noted above, thereby knocking two birds with one stone. This way also users who *want* to opt-in to PAT do so willing-fully and knowing of the limitation. The kconfig option can just enable a module parameter to a default value, which if the kconfig is disabled would otherwise be unset. static bool ivtv_force_pat = IS_ENABLED(CONFIG_IVTV_WHATEVER); module_param_named(force_pat, ivtv_force_pat, bool, S_IRUGO | S_IWUSR); Luis