From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [RFC PATCHv1] serial: Support OXPCIe952 aka Oxford Semiconductor Ltd Device c138 (1415:c138) Date: Tue, 4 Mar 2014 08:29:43 -0500 Message-ID: <20140304132943.GA3449@localhost.localdomain> References: <201403041036.s24AaOu9019510@userz7021.oracle.com> <5315BF940200007800120CC2@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WKpPw-0007eT-RD for xen-devel@lists.xenproject.org; Tue, 04 Mar 2014 13:29:57 +0000 Content-Disposition: inline In-Reply-To: <5315BF940200007800120CC2@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: konrad@kernel.org, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Tue, Mar 04, 2014 at 10:57:08AM +0000, Jan Beulich wrote: > >>> On 04.03.14 at 11:36, Konrad Rzeszutek Wilk wrote: > > > On Mar 4, 2014 4:43 AM, Jan Beulich wrote: > >> > >> >>> On 04.03.14 at 03:01, Konrad Rzeszutek Wilk wrote: > >> > @@ -325,11 +342,12 @@ static void __init ns16550_init_preirq(struct > > serial_port *port) > >> > #ifdef CONFIG_X86 > >> > enum fixed_addresses idx = FIX_COM_BEGIN + (uart - ns16550_com); > >> > > >> > - set_fixmap_nocache(idx, uart->io_base); > >> > + set_fixmap_nocache(idx, uart->io_base + uart->offset); > >> > uart->remapped_io_base = (void __iomem *)fix_to_virt(idx); > >> > uart->remapped_io_base += uart->io_base & ~PAGE_MASK; > >> > >> Don't you need to add in uart->offset here too? > > > > The virtual address at that point already covers then BAR + offset. > > Hardly: fix_to_virt() returns a page-aligned address, and anything > that may affect the offset-in-page value needs to be taken into > consideration in the right side expression of the +=. Oh, this is not a offset-in-page (well, it is, but also past the first page). In this case the offset ends up being BAR + 0x1000 + 0x200 * idx. It is well past the first page. Perhaps splitting it up in two offsets would be better? set_fixmap_nocache(idx, uart_io_base + uart->pfn_offset * PAGE_SIZE); uart->remapped_io_base = (void __iomem)*fix_to_virt(idx); uart->remapped_io_base += uart->io_base + uart->offset & ~PAGE_MASK; And of course we make sure that offset is within 0->4096. > > Jan >