From owner-freebsd-virtualization@FreeBSD.ORG Sun Dec 29 03:14:03 2013 Return-Path: Delivered-To: virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAE97E38; Sun, 29 Dec 2013 03:14:02 +0000 (UTC) Received: from mail-qc0-x22d.google.com (mail-qc0-x22d.google.com [IPv6:2607:f8b0:400d:c01::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9AB701210; Sun, 29 Dec 2013 03:14:02 +0000 (UTC) Received: by mail-qc0-f173.google.com with SMTP id m20so9979939qcx.18 for ; Sat, 28 Dec 2013 19:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=F0PI4CjoFDE/wbDwPLRDZ4wDRz3YxiPBQdV9XUnuqf4=; b=KvHAzx5O8Y1R2hlkV2HoNFON9i5BsdoJ8kla/cuoMkriYQU4Mb3CQY0SrnAYEQfjC6 y7AwYs6GJTTxt8cb2+aoif4Is60dXYpfOP2F8yDPlOvLObM2fW4rKGj2CW0UT3duiXI3 M3sp65Bf6vE33NqxGHeNZad7aVWsRVKN8O6de9t5yebrb49Jff4uzwlQtTh9E2Y+tzkY F7wfJoCWYSEfnFzFuj823UWqW+BLXE84gpaR4hxBfUfe5EQNO8fvJy6AgsJZsVw8J4cm G7GmwjZyL1aucydhj6ADn7vD9tDbtrSwo7V+sWGYHx8NjCkeE70mj8BxrnpojMOEByTT MbFw== MIME-Version: 1.0 X-Received: by 10.224.162.211 with SMTP id w19mr26898123qax.53.1388286841729; Sat, 28 Dec 2013 19:14:01 -0800 (PST) Received: by 10.140.34.17 with HTTP; Sat, 28 Dec 2013 19:14:01 -0800 (PST) In-Reply-To: <201312271205.54102.jhb@freebsd.org> References: <201312271205.54102.jhb@freebsd.org> Date: Sat, 28 Dec 2013 19:14:01 -0800 Message-ID: Subject: Re: [PATCH] Rework DSDT generation in bhyve From: Neel Natu To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2013 03:14:03 -0000 Hi John, On Fri, Dec 27, 2013 at 9:05 AM, John Baldwin wrote: > While hacking on the power button support, I also started rototilling the DSDT > generation code a bit. My initial goal was to enumerate the LPC serial ports > (COM1 and COM2) properly via ACPI. I ended up doing the following: > > - Moved the info for the top-level PCI bus into the PCI emulation code and > added ResourceProducer entries for the memory ranges decoded by the bus > for memory BARs. > - I added a framework to allow each PCI emulation driver to optionally write > an entry into the DSDT under the \_SB_.PCI0 namespace. The LPC driver uses > this to write a node for the LPC bus (\_SB_.PCI0.ISA). > - I added a linker set to allow any LPC devices to write entries into the > DSDT below the LPC node. I moved the existing block for the RTC out of > acpi.c and into the RTC driver. I added DSDT nodes for the AT PIC, > the 8254 ISA timer, and the LPC UART devices. > - I also added a "SuperIO" device under the LPC node to claim "system > resources" (as is done in real hardware). I added a linker set to allow > various drivers to add IO or memory ranges that should be claimed by > SuperIO and then added the extended RTC IO range and the registers used > for ACPI power management as system resources. > > The end result is that for the stock VM created by vmrun.sh, the attimer0, > uart0, and uart1 devices move from isa0 to acpi0. There is also a PIC > device that would be claimed by 'device atpic' (but the stock amd64 kernel > doesn't include that). The DSDT is also a bit more fleshed out, and also > looks "nice" as devices are mostly laid out in the normal tree rather than > using separate Scope() sections for each device. > > Note that I did add some helper routines for writing out DSDT lines and > resource entries to try to simplify the code in the various DSDT handlers > and make the code that generates DSDT lines a bit more readable (e.g. the > implicit newlines make things more readable IMO). > > The patch is relative to the previous power button patch and is at > http://www.FreeBSD.org/~jhb/patches/bhyve_dsdt.patch > This looks great! This is not related to your patch (it has always been there), but I was trying to understand the significance of this entry: pci_lpc_write_dsdt(): OperationRegion (P40C, PCI_Config, 0x60, 0x04) Any idea on why this is needed/interesting? best Neel > Assuming these are ok, the next thing I might work on is cleaning up > the PCI INTx interrupts. They should really all be rounted to the I/O APIC > intpins above 15 (and we should leave ISA IRQs 5, 10, and 11 alone in APIC > mode and only fall back to that if we are using the 8259As and a real ELCR). > The MP Table output would need some minor tweaking for that, and for ACPI we > should generate a _PRT table under _SB_.PCI0 in pci_emul.c. > > -- > John Baldwin > _______________________________________________ > freebsd-virtualization@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization > To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe@freebsd.org"