Received: by 10.223.185.116 with SMTP id b49csp5399051wrg; Wed, 7 Mar 2018 11:04:16 -0800 (PST) X-Google-Smtp-Source: AG47ELvMrbBpK2iG9L7Qp/OR2nveBkkoLK4OUFDaDG0GemJNi/fXa9e1Um8cMDh+RHtZ1R6MDWhp X-Received: by 2002:a17:902:bd46:: with SMTP id b6-v6mr15990216plx.247.1520449456524; Wed, 07 Mar 2018 11:04:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520449456; cv=none; d=google.com; s=arc-20160816; b=ncGVby8Ja8acCApc5eDporTm3TYlGj8sqwzgkZEcbaJq1qCDvFLQs/sNWU0bFDXL5o FPrkZsYYyJ5pVdQ5uG+8hrg+qIm9AwA3PhcAvIrQNCdc3MehGvKXtyct8sEjT8zzA65B pngiIOBw45aMouUDTMyTOjDFn+2S36SPsdRVztARVMCxoRzEZ/INwzP46wwOTNaPFA8/ srI0RdQfFjzO1DLByEr51kx75Impxwz4ME0wK9kZf8mLmiBNsiSDDd0/jeot2pE8MUi/ cA15BYcsaSTDoRHm3DSr+euH1WajOlbN4ig5Qn1unYJkCAgRPinnQ5FwYSoAXsSV9Ye5 gRYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=HT/er1Bzi0KqRhheOOnx0nynefzog+/TeQYW5haDG7A=; b=hUnig1phaFDUkuPjzzya6hqfTDN264kBdJzTxUul+/B0FZRr7+rdlERPuGTg8mPoHj zu6qFluqRFDA8E9DKGpC97vJmM+2KhoeBiAOemjnJzF5WWuLaUUqfkKIP3JAeVpNQAnp jsRbhVGiW+/+ioULz71NvBP+MnSTB68RPXZV8cZdrirI0HLOqGAn+zWikoH84aS6HW+V NqufXkGvbvUOGesrbOLyHeDbZgr6borWc62RWKdYa5wc2eGRQi2uZcOMVM05modYkTPe YHhLizumRk4FnZZ+8LeaEgWkorc/hnqEI8uma9bQszOhJTDn5OY3MekvJaLkfWq3c/ju P6gQ== 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 g34-v6si13466202pld.513.2018.03.07.11.04.01; Wed, 07 Mar 2018 11:04:16 -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 S1754696AbeCGTCJ (ORCPT + 99 others); Wed, 7 Mar 2018 14:02:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:42796 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754580AbeCGTCI (ORCPT ); Wed, 7 Mar 2018 14:02:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2B8C3AF75; Wed, 7 Mar 2018 19:02:05 +0000 (UTC) Date: Wed, 7 Mar 2018 19:02:05 +0000 From: "Luis R. Rodriguez" To: "French, Nicholas A." Cc: "Luis R. Rodriguez" , hans.verkuil@cisco.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: ivtv: use arch_phys_wc_add() and require PAT disabled Message-ID: <20180307190205.GA14069@wotan.suse.de> References: <20180301171936.GU14069@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 06, 2018 at 09:01:10PM +0000, French, Nicholas A. wrote: > any reason why PAT can't be enabled for ivtvfb as simply as in the attached > patch? diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 621b2f613d81..69de110726e8 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -1117,7 +1117,7 @@ static int ivtvfb_init_io(struct ivtv *itv) oi->video_buffer_size = 1704960; oi->video_pbase = itv->base_addr + IVTV_DECODER_OFFSET + oi->video_rbase; - oi->video_vbase = itv->dec_mem + oi->video_rbase; + oi->video_vbase = ioremap_wc(oi->video_pbase, oi->video_buffer_size); Note that this is the OSD buffer setup. The OSD buffer info is setup at the start of the routine: struct osd_info *oi = itv->osd_info; And note that itv->osd_info is kzalloc()'d via ivtvfb_init_card() right before ivtvfb_init_io(), which is the routine you are modifying. Prior to your change the OSD buffer was obtained using the itv->dec_mem + oi->video_rbase given itv->dec_mem was initialized via the ivtv driver module, one of which's C files is: drivers/media/pci/ivtv/ivtv-driver.c and has: if (itv->has_cx23415) { ... itv->dec_mem = ioremap_nocache(itv->base_addr + IVTV_DECODER_OFFSET - oi->video_buffer_size, IVTV_DECODER_SIZE); ... else { itv->dec_mem = itv->enc_mem; } The way it used to work then it seems to be that we have a main ivtv driver which does the ioremap off of the decoder and uses that as offset. If its not the special cx23415 it still sets the decoder mapped offset to the encoder offset. So if you wanted to do what you mention in the above hunk I think you'd then have to also proactively reduce the size of the ioremap_nocache()'d size on the ivtv driver first. It would probably make your programming easier if you know if the cx23415 had no frame buffer too, as then the ivtvfb driver would not have to be concerned for variants, or the ivtv change would only be relevant for cx23415 varaint users. So what I'd do is change the ioremap_nocache()'d size by substracting oi->video_buffer_size -- but then you have to ask yourself how you'd get that size. If its something you can figure out then great. The ivtv driver is a bit odd in that ivtvfb_init() will issue ivtvfb_callback_init() on each registered device the ivtv driver registered, so care must be taken with order as well on tear down. Good luck! Luis @@ -1157,6 +1157,8 @@ static void ivtvfb_release_buffers (struct ivtv *itv) /* Release pseudo palette */ kfree(oi->ivtvfb_info.pseudo_palette); arch_phys_wc_del(oi->wc_cookie); + if (oi->video_vbase) + iounmap(oi->video_vbase); kfree(oi); itv->osd_info = NULL; } @@ -1167,13 +1169,6 @@ static int ivtvfb_init_card(struct ivtv *itv) { int rc; -#ifdef CONFIG_X86_64 - if (pat_enabled()) { - pr_warn("ivtvfb needs PAT disabled, boot with nopat kernel parameter\n"); - return -ENODEV; - } -#endif - if (itv->osd_info) { IVTVFB_ERR("Card %d already initialised\n", ivtvfb_card_id); return -EBUSY;