From patchwork Sun Mar 11 00:15:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "French, Nicholas A." X-Patchwork-Id: 10274465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60CA060594 for ; Sun, 11 Mar 2018 00:32:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D777292F6 for ; Sun, 11 Mar 2018 00:32:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42340294FB; Sun, 11 Mar 2018 00:32:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAE00292F6 for ; Sun, 11 Mar 2018 00:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751224AbeCKAbt (ORCPT ); Sat, 10 Mar 2018 19:31:49 -0500 Received: from mx0b-00272701.pphosted.com ([208.86.201.61]:55066 "EHLO mx0b-00272701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbeCKAbs (ORCPT ); Sat, 10 Mar 2018 19:31:48 -0500 X-Greylist: delayed 989 seconds by postgrey-1.27 at vger.kernel.org; Sat, 10 Mar 2018 19:31:47 EST Received: from pps.filterd (m0107987.ppops.net [127.0.0.1]) by mx0b-00272701.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2B0Bx3o006050; Sat, 10 Mar 2018 18:15:15 -0600 Received: from nam01-sn1-obe.outbound.protection.outlook.com (mail-sn1nam01lp0111.outbound.protection.outlook.com [207.46.163.111]) by mx0b-00272701.pphosted.com with ESMTP id 2gmafxafhm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 10 Mar 2018 18:15:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sooners.onmicrosoft.com; s=selector1-ou-edu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wWOFPSOM/QI0UhujcKgvAia8yT1yufl6K5MgKU1dJTA=; b=U7IYdPU6SD/qCHojKqAoi61R1yljZJqybkyM1aC5XvQIEns4iIoUrw26l8X7dWRE1/xzqxn5hLL+L5VOHW4Wul2I5cgQ7WrAI3S/E6dsuMB2C4pl1QyTUCJREAwLu4+SYT1wclUsO2TZg/1FlOQwOUUGSnB8QCNtnDlSlQJ/7j8= Received: from tivo.lan (155.94.246.64) by DM5PR03MB3035.namprd03.prod.outlook.com (2603:10b6:3:11e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Sun, 11 Mar 2018 00:15:12 +0000 Date: Sat, 10 Mar 2018 18:15:08 -0600 From: Nick French To: Andy Walls , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Luis R. Rodriguez" Subject: [PATCH] media: ivtv: add parameter to enable ivtvfb on x86 PAT systems Message-ID: <20180311001508.GA13581@tivo.lan> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [155.94.246.64] X-ClientProxiedBy: DM5PR19CA0021.namprd19.prod.outlook.com (2603:10b6:3:151::31) To DM5PR03MB3035.namprd03.prod.outlook.com (2603:10b6:3:11e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f40a591-7914-4070-cfd4-08d586e5285c X-Microsoft-Antispam: UriScan:(275421118447822); BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989060)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990040)(2017052603328)(7167020)(7153060)(7193020); SRVR:DM5PR03MB3035; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3035; 3:9qxvC4kE0v7+H8IAIRUbQzvuD8Im5zPiz5mkDFhN6KM6Uvv3BftcZ51RUF4OMUIrSoCH/g/kqioODMZUnn4dRsFed/13S3WiVnIEqPLn6cTGZfYMrmoZtISjunWYJ4SDCvpJbi3W6KbtEbMNbQdheLIgJQGxporiJ7gsDp/fUzeJB/1EVAfm3faXoAY4o977cQdwXiFqJPPNVRx1p8/wfYEDIWmruLlZJlsO9QmLokiTJ+C1qsXoFiN+lIKxpiBbCYpLJDU+Rso6fGb0KA/MEDQJ7OpjYq2QolMvz8KSdKQ=; 25:zWI4qhRdxZsAgO57FT/R7LWUILSiQK+P3IDrNMiBnlRh3+7Hdva6bbl6xLk+L9KCiicIhNzQa7kTO+8uGS0MUWUE3f1UmF3zr+JA7u08CqE4X2KMa8M6DgyegH/lzzxQ15PJomc1EcE4591k3tgDu4gkCCMPXideY0U7radede/SIqTi2xD6NV1o9d5qCz8J16nwl47+PUafQZDPBMSHi0jEd2uynjGcS4SkP6czQq75+xZrVX5uIHHYFZDmUpUOf4YKWTYmCCf2vmgK9BImOq8Z17Q/+c1V2/u+lpmr6jEYV7p5a/C3BKhhKIIAMt2tRYbgLLqqD1GE19cxPZk2Tw==; 31:ytf9ogKaw6Asm4X93scRsG8omqU5aSDK1ZdjDoSj5+6LFUMbz4T6hkNXcTL8X2aT6VcS2Bddu26SljAXtWx1BkVnwv0ikACYzdgq13E/12d5P+hcjPa0XXrjrkFnN4p+7D0kwXgtOUjWSabcsTa+V1PKW8N0UqT30bvVd/FfAmnlbwZuZRjWNc1rgogicpkqmEew7FitrAg61X21M7X3N56GA0hQVUDAarj//tU23xs= X-MS-TrafficTypeDiagnostic: DM5PR03MB3035: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3035; 20:EbWuGZ7IxukkqkuWMdZROXw87t9yfgUmrJ5x6gMtqYf/MxOM3s6giq26CQ+LWU44yfu0nqk6nemIgA1DlJO+gMsTMXuwEdbxd+Y/y5ICpYM92krotHIF+sRVE//ehNd/ViD6VNU8dmodODPToSfBJyyi6+S6fkQ7TYH6FMPaNTQO2V1xx8yuNHwsjdyMqFriwSVpYqo4ULcoCOeFyuEsNeHB0EfX4AXyujzoLN35HYpKGgDJH3KXUj64otmdbwVaB1YofN6NGDE8UWaAOnbOrJTBFQ64dgsWtvimP/wf3U7j2eR4vhnR7qSP4x+sv3SAopFQLBUnMkOox58yZJDCCDAGyIhJ7mreinFSIj+Tc9RTmUMxyyFHF13yvIIGqtB/HElrYTEh8PXTZ0CaPP1QvI97ByLcIshjgLPlo3IqdG0uIP3+CL9QGxfYoA3Fm/+Q2Wo+pemJxaPRat6lQt/HSvAqIO4kYkd1dzzwQNis2QYaUD0/9S5cAaLCLd7T5+ON; 4:qhiBnnU9OBSFPiIK3xAWARufqvYxDDKIt6hvtBxosjI+7MJ8ezaXnouVw/pwpkC6cOvb/4614IyDUG2HM9J/zYBlrco9hUN06b/+AcVLyB5Xb2kCO41FPFtgqK2N1Yy+SOqXlLXCcHSu9jAHvBD60V6+3kANN9Hjvsjk3juZpEi/08v+B+yzJPu7pXUlUAI5oZQD8ly6f0B0j1qriX5O5IrMCN8b59ftqzWIZtR2i0mLjzo7KjTcBQycvfas1O5e0t3jdOVXcjWt9KvBircSio1ZJuTnf0C3GolAPnbNmtEo5P+k9iv71R73pBsRQsO87Nyp3BnUnDoCweJd6LZeMkUvCdk74y+AH+avUvNvQaY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(179259710895377)(275421118447822); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(3231220)(944501244)(52105095)(10201501046)(93006095)(93001095)(6041310)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR03MB3035; BCL:0; PCL:0; RULEID:; SRVR:DM5PR03MB3035; X-Forefront-PRVS: 0608DEDB67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(366004)(346002)(396003)(39380400002)(189003)(199004)(23726003)(8936002)(86362001)(3846002)(6116002)(1857600001)(81156014)(81166006)(8676002)(7736002)(75432002)(66066001)(36756003)(305945005)(21086003)(4326008)(1076002)(47776003)(52116002)(7696005)(105586002)(106356001)(478600001)(2906002)(25786009)(55016002)(33656002)(16526019)(69596002)(186003)(88552002)(50466002)(6666003)(6306002)(26005)(68736007)(386003)(316002)(55236004)(5660300001)(6506007)(97736004)(786003)(110136005)(53936002)(59450400001)(9686003)(58126008)(16586007)(2320200001)(18370500001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR03MB3035; H:tivo.lan; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: ou.edu does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB3035; 23:45BGMm4uuKliirQoWPuyw1l6X6MrbTemjlrjl0yZV?= =?us-ascii?Q?bXqbPATBOBXXiNx+syeeMAVlvZaoMW7b7tXLwb7XUQBiEq8FcijV5RwAauzw?= =?us-ascii?Q?TPz1T4BXzrdSp36jy0hAESUzVaqmjciUMZajYouMQnJEx8qnH8/3ESi0JaGw?= =?us-ascii?Q?1be7hOEBb8DdvVDwtjufLPa64h3WOo32guKQX9XAfdnh3hl97fdWLrSCBELp?= =?us-ascii?Q?KVms8fTzKXUHsMwM7MY25lPtu8S659Di304TZD9R8kub/Dh6dkdDeBt/sWWS?= =?us-ascii?Q?fhfjn0Q0hyYKyNLV5moieWXq5hbPktz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FlLiJ6BGJv+wrRkJtu0TNa3zhD4q1W8YC5nLgCvz3WqG9iT47fBFWQ2QUx1ZWN0=; 7:Z+BszWtifr8PMcX2C1rmT/Zhiweeu9dOL6M5mhO3gMQZvItSyxBlatVYfusjVK/SQNA1mgZuOHd94lOZFK9R1gNbHIlgkVOaUda/DOSKeqoepygVe2YHBb21OFw8TjPgDbB8jlemxj8F3eyulkYtKbSQqeMz0XO6+rzYPi24GRSeZKngXz10gzfuP+oViipeSu5Xv2ZXAzsytdghBsNpsKeg6iORrfQnyz6dZOyFV0MU0YCDGgEEXQUxBdHgUdEw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3035; 20:jwq0w/il5+YDcBA9vPCna86YEgE3YeQlMCddxsZ1EOjU+noWuMHro0V3BIRQ2ZD6jjngCilm8do+vQrxYY4Rmlz1aKm8LfPzRVxoJTsv90yDPpsRdUSqzWNv8835IR/qCSc+zgm5KuYEhcB4qfOUXwJOEXkdfICwJOWDFornJHs= X-OriginatorOrg: ou.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2018 00:15:12.1847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f40a591-7914-4070-cfd4-08d586e5285c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 9c7de09d-9034-44c1-b462-c464fece204a X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB3035 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-10_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803110001 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ivtvfb was previously disabled for x86 PAT-enabled systems by commit 1bf1735b4780 ("x86/mm/pat, drivers/media/ivtv: Use arch_phys_wc_add() and require PAT disabled") as a workaround to abstract MTRR code away from device drivers. The driver is not easily upgradable to the PAT-aware ioremap_wc() API since the firmware hides the address ranges that should be marked write-combined from the driver. However, since a write-combined cache on the framebuffer is only a performance enhancement not a requirement for the framebuffer to function, completely disabling the driver in this configuration is not necessary. Add force_pat module parameter and a corresponding kernel configuration parameter to optionally force initialization on PAT-enabled x86 systems with a warning about the lack of write-combined caching. Signed-off-by: Nick French --- drivers/media/pci/ivtv/Kconfig | 19 ++++++++++++++++--- drivers/media/pci/ivtv/ivtvfb.c | 19 +++++++++++++++++-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/ivtv/Kconfig b/drivers/media/pci/ivtv/Kconfig index c72cbbd2d40c..9c63370ed721 100644 --- a/drivers/media/pci/ivtv/Kconfig +++ b/drivers/media/pci/ivtv/Kconfig @@ -70,8 +70,21 @@ config VIDEO_FB_IVTV This is used in the Hauppauge PVR-350 card. There is a driver homepage at . - In order to use this module, you will need to boot with PAT disabled - on x86 systems, using the nopat kernel parameter. - To compile this driver as a module, choose M here: the module will be called ivtvfb. + +config VIDEO_FB_IVTV_FORCE_PAT + bool "force cx23415 frambuffer init with x86 PAT enabled" + depends on VIDEO_FB_IVTV && X86_PAT + default n + ---help--- + With PAT enabled, the cx23415 framebuffer driver is not able to + utilize write-combined caching on the framebuffer memory. + The default behaviour is to disable the framebuffer completely + when it detects PAT is enabled in the kernel (i.e. not using + the nopat kernel parameter) + + With this setting enabled, the framebuffer will initialize on + PAT-enabled systems but the framebuffer memory will be uncached. + + If unsure, say N. diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 621b2f613d81..5df74721aa19 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -55,6 +55,7 @@ /* card parameters */ static int ivtvfb_card_id = -1; static int ivtvfb_debug = 0; +static bool ivtvfb_force_pat = IS_ENABLED(CONFIG_VIDEO_FB_IVTV_FORCE_PAT); static bool osd_laced; static int osd_depth; static int osd_upper; @@ -64,6 +65,7 @@ static int osd_xres; module_param(ivtvfb_card_id, int, 0444); module_param_named(debug,ivtvfb_debug, int, 0644); +module_param_named(force_pat, ivtvfb_force_pat, bool, 0644); module_param(osd_laced, bool, 0444); module_param(osd_depth, int, 0444); module_param(osd_upper, int, 0444); @@ -79,6 +81,9 @@ MODULE_PARM_DESC(debug, "Debug level (bitmask). Default: errors only\n" "\t\t\t(debug = 3 gives full debugging)"); +MODULE_PARM_DESC(force_pat, + "Force initialization on x86 PAT-enabled systems (bool).\n"); + /* Why upper, left, xres, yres, depth, laced ? To match terminology used by fbset. Why start at 1 for left & upper coordinate ? Because X doesn't allow 0 */ @@ -1169,8 +1174,18 @@ static int ivtvfb_init_card(struct ivtv *itv) #ifdef CONFIG_X86_64 if (pat_enabled()) { - pr_warn("ivtvfb needs PAT disabled, boot with nopat kernel parameter\n"); - return -ENODEV; + if (ivtvfb_force_pat) { + pr_info("PAT is enabled. Write-combined framebuffer " + "caching will be disabled. To enable caching, " + "boot with nopat kernel parameter\n"); + } else { + pr_warn("ivtvfb needs PAT disabled for write-combined " + "framebuffer caching. Boot with nopat kernel " + "parameter to use caching, or use the " + "force_pat module parameter to run with " + "caching disabled\n"); + return -ENODEV; + } } #endif