Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4508613ybp; Mon, 7 Oct 2019 09:27:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzF3/FVweh3/TOnz5rSBud3U5VV05rieQeHb4TZditj/mHxDGM64P7EUcY21ODaGhB8v/Fx X-Received: by 2002:aa7:db02:: with SMTP id t2mr29569708eds.252.1570465660671; Mon, 07 Oct 2019 09:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570465660; cv=none; d=google.com; s=arc-20160816; b=TxIZbENXE9qi7vunZ6uwZxDhbcbM4huOd5J5hmkCb5jUoyVgOVVmFHUE/VYFPGLk11 FpX4wIRv529dpjsDMzWkOQgVndnVZHx9kIREjL2WrtPOzi4oF3HV+7t4fwV5HNco4d1F ww0P6XGY6id8jghnOXp2DhA14RBB4EDJDy/3W6rcAgvlg7pM2EX/YK8D/9LzZtDags2M 6bb5nuf2VDiVCSjZFXm3kwbfxwA6sGtU670E7Q601/znPQxQZIFgSobM41HM9wQVL6yA hI7CJLzZeKi51xomKXLzikdoEVrrzoMB+jx8siRCljT70whGdIHyedhb5M/PiFoU43CF KHgg== 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:dkim-signature; bh=XL20VwtPRbGDGcN+4iS4qA165VAWOZtyxaE4mR0KPqk=; b=iouRWMkEYleUCrkNEqlBZ/2wDEYWRRSp3zgwBYXYplaFbOHxPvCmqk/3oAatTFtDAm Dlmeq30U1JMgFxU/Gu3unyC1BXfX7ZT3sBuzCWSpKKsaOLuO/5NhAkrV0nJp68EdOYoX IZwcS+mQCqKAo9+euz6YCWKoHdO6QtLZeoFCDyYVtxeyXDvbkkdU0OcHmO+KTZd8nn3R C22CQ/FexrAaAzhlyoqwscBaTG0HjJFYZd2lit6WMu5FCayNflYiAeZ6TPoEjKeYnlZu s2K1F1qJ9GcvLODObEvDsnCZYUmX8UpFjLeabVq64yZZ8IPBFkc6pgyuoFAKxICwtCUo TOgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=I3AvTecs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si8287859edy.441.2019.10.07.09.27.16; Mon, 07 Oct 2019 09:27:40 -0700 (PDT) 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; dkim=pass header.i=@alien8.de header.s=dkim header.b=I3AvTecs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728528AbfJGQ0n (ORCPT + 99 others); Mon, 7 Oct 2019 12:26:43 -0400 Received: from mail.skyhub.de ([5.9.137.197]:56234 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbfJGQ0n (ORCPT ); Mon, 7 Oct 2019 12:26:43 -0400 Received: from zn.tnic (p200300EC2F06420085D86D94306C6599.dip0.t-ipconnect.de [IPv6:2003:ec:2f06:4200:85d8:6d94:306c:6599]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 55BE21EC0C2B; Mon, 7 Oct 2019 18:26:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1570465598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=XL20VwtPRbGDGcN+4iS4qA165VAWOZtyxaE4mR0KPqk=; b=I3AvTecs4eP6o5KdbyyhNC4S4MrvUdz5MO4eMukYm2UnIcTrZgtcZ4BlNfq8MaZaFUJMgA ntCTOpufgkSXaOa2uo5mI8ar+4UGwigbYTgucjveMEno3JL8bb5GdSGp+k86irNkFFVkA4 NlnaELXPydx9bBNZ3xoty6FfdykmjwQ= Date: Mon, 7 Oct 2019 18:26:36 +0200 From: Borislav Petkov To: Ralf Ramsauer Cc: Jan Kiszka , x86@kernel.org, jailhouse-dev@googlegroups.com, linux-kernel@vger.kernel.org, Ingo Molnar , "H . Peter Anvin" Subject: Re: [PATCH v5 2/2] x86/jailhouse: Only enable platform UARTs if available Message-ID: <20191007162636.GD24289@zn.tnic> References: <20191007123819.161432-1-ralf.ramsauer@oth-regensburg.de> <20191007123819.161432-3-ralf.ramsauer@oth-regensburg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191007123819.161432-3-ralf.ramsauer@oth-regensburg.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 07, 2019 at 02:38:19PM +0200, Ralf Ramsauer wrote: > ACPI tables aren't available if Linux runs as guest of the hypervisor > Jailhouse. This makes the 8250 driver probe for all platform UARTs as > it assumes that all platform are present in case of !ACPI. Jailhouse I think you mean s/platform/UARTs/ here. > will stop execution of Linux guest due to port access violation. > > So far, these access violations could be solved by tuning the > 8250.nr_uarts parameter but it has limitations: We can, e.g., only map Another "We" you can get rid of. > consecutive platform UARTs to Linux, and only in the sequence 0x3f8, > 0x2f8, 0x3e8, 0x2e8. > > Beginning from setup_data version 2, Jailhouse will place information of > available platform UARTs in setup_data. This allows for selective > activation of platform UARTs. > > This patch queries the setup_data version and activates only available s/This patch queries/Query/ > UARTS. It comes with backward compatibility, and will still support > older setup_data versions. In this case, Linux falls back to the old > behaviour. > > Signed-off-by: Ralf Ramsauer > --- > arch/x86/include/uapi/asm/bootparam.h | 3 + > arch/x86/kernel/jailhouse.c | 83 +++++++++++++++++++++++---- > 2 files changed, 74 insertions(+), 12 deletions(-) ... > @@ -138,6 +147,53 @@ static int __init jailhouse_pci_arch_init(void) > return 0; > } > > +#ifdef CONFIG_SERIAL_8250 > +static bool jailhouse_uart_enabled(unsigned int uart_nr) > +{ > + return setup_data.v2.flags & BIT(uart_nr); > +} > + > +static void jailhouse_serial_fixup(int port, struct uart_port *up, > + u32 *capabilities) > +{ > + static const u16 pcuart_base[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8}; > + unsigned int n; > + > + for (n = 0; n < ARRAY_SIZE(pcuart_base); n++) { > + if (pcuart_base[n] != up->iobase) > + continue; > + > + if (jailhouse_uart_enabled(n)) { > + pr_info("Enabling UART%u (port 0x%lx)\n", n, > + up->iobase); > + jailhouse_setup_irq(up->irq); > + } else { > + /* Deactivate UART if access isn't allowed */ > + up->iobase = 0; > + } > + break; > + } > +} WARNING: vmlinux.o(.text+0x4fdb0): Section mismatch in reference from the function jailhouse_serial_fixup() to the variable .init.data:can_use_brk_pgt The function jailhouse_serial_fixup() references the variable __initdata can_use_brk_pgt. This is often because jailhouse_serial_fixup lacks a __initdata annotation or the annotation of can_use_brk_pgt is wrong. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette