From nobody Thu May 16 07:11:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600689329; cv=none; d=zohomail.com; s=zohoarc; b=G0F6nMd/ZjNo/SgyYD7HviC0P52Vfi5jhOJXBHVRdAtghgMKnvGifuIMNeiVovUr2zDi888SwIQBYux45eGFjwezHIFllQQqY2zCG9BMAHAnw//dfFlooIjGyPH2AtKLw6Bn1l/fNn5WeW0b9px+6D24huCRRB012gj6nPdkb10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600689329; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c6pD2+Pc8POfcBxmxk90BGRRuH6Y8wbJMwjn9MiDPb8=; b=EM6pD7/SbzEZ9TIl09nT4WDl0CJ2nxePFWqLQXLbSoJ1aVs6gicysoKj3gVZO1o7Qga3DmDVtUX9KVPOdPzXR2iy4e9uG8TXgiKRw+MkDUoiZLBccSpwhjcwcL1IAebF1AmmzOzz7Y+2MMZymK9mI8i4d0YejVFWKZKNNKDJlnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600689329018937.1961798318096; Mon, 21 Sep 2020 04:55:29 -0700 (PDT) Received: from localhost ([::1]:35950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKKPm-00062X-Ee for importer@patchew.org; Mon, 21 Sep 2020 07:55:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKKG7-0002vu-3C for qemu-devel@nongnu.org; Mon, 21 Sep 2020 07:45:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:43229 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKKG4-0002a1-Ld for qemu-devel@nongnu.org; Mon, 21 Sep 2020 07:45:26 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-lI26gkozP261_3IDl0ZEPQ-1; Mon, 21 Sep 2020 07:45:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 18BE09CC0C; Mon, 21 Sep 2020 11:45:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 153FE7366A; Mon, 21 Sep 2020 11:45:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CF49B16E16; Mon, 21 Sep 2020 13:45:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600688723; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c6pD2+Pc8POfcBxmxk90BGRRuH6Y8wbJMwjn9MiDPb8=; b=efTkzcAfX9+KFF6T+6AfTMhG9bdqlqEe2txs/eZGmccP7Zvr/iXfN9gjLzdNmimFILu0dH a1wXDgThYI9s9cEOdTYBpAAKS1VVhizDfVEgla0xqLH95wmLkhYeat/g2gcO4Slp/SH1Wf 14lhzaLIDC/tMBApEiLMLTMuUpXfZnY= X-MC-Unique: lI26gkozP261_3IDl0ZEPQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 1/2] microvm: add irq table Date: Mon, 21 Sep 2020 13:45:08 +0200 Message-Id: <20200921114509.14511-2-kraxel@redhat.com> In-Reply-To: <20200921114509.14511-1-kraxel@redhat.com> References: <20200921114509.14511-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/21 07:01:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Sergio Lopez , "Michael S. Tsirkin" , Sai Pavan Boddu , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add a comment with a table listing the IRQs, both legacy pc and microvm side-by-side. Signed-off-by: Gerd Hoffmann --- include/hw/i386/microvm.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index be2d95af4d74..27eadd6c535c 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -27,6 +27,28 @@ #include "hw/acpi/acpi_dev_interface.h" #include "qom/object.h" =20 +/* + * IRQ | pc | microvm (acpi=3Don) + * --------+------------+------------------ + * 0 | pit | + * 1 | kbd | + * 2 | cascade | + * 3 | serial 1 | + * 4 | serial 0 | serial + * 5 | - | + * 6 | floppy | + * 7 | parallel | + * 8 | rtc | rtc (rtc=3Don) + * 9 | acpi | acpi (ged) + * 10 | pci lnk | + * 11 | pci lnk | + * 12 | ps2 | + * 13 | fpu | + * 14 | ide 0 | + * 15 | ide 1 | + * 16-23 | pci gsi | virtio + */ + /* Platform virtio definitions */ #define VIRTIO_MMIO_BASE 0xfeb00000 #define VIRTIO_NUM_TRANSPORTS 8 --=20 2.27.0 From nobody Thu May 16 07:11:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600689403; cv=none; d=zohomail.com; s=zohoarc; b=YjX4GayuBBMk4WjYdmMVKiDeKVb1BR4wBQoV/6XgLM6gED+pRAyAtI0pg/z8PDCCTUdPKr+8ot/++uSSr+SpWKd8zI7BZ//PHqX518i+1q+7ipzuTlouwgNqMUk1fv58dwy1LBgkX/JtRMsIQuCg+E4Zysb9MmE3IwAPTwYUFVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600689403; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nov3hMfz33U+yqvP0A61L4yla7ySq2UFMPH9rNuTgpg=; b=V5M49iMzPsCTOjsjew3L5z9kZ4gnbLdCvZw0ApiyLC7OsD5Ag+1TKt+GBQfF4n5ywuRIFpXeWrKdlxeh6RTfo5VR4lF+DQhcS5bhzVsnsLuTzvnDYbUSXy10Tt7ARiBkQvbxRQJsR6UmySk5IoZBJ1+ZQeovPFR110WrspU6nok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600689403403299.9497334751594; Mon, 21 Sep 2020 04:56:43 -0700 (PDT) Received: from localhost ([::1]:38936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKKR0-0007Pd-0i for importer@patchew.org; Mon, 21 Sep 2020 07:56:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKKG8-0002zP-Gv for qemu-devel@nongnu.org; Mon, 21 Sep 2020 07:45:28 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:30552 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKKG6-0002bX-33 for qemu-devel@nongnu.org; Mon, 21 Sep 2020 07:45:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-MXtvkae3MGeYzFaL-lEUZQ-1; Mon, 21 Sep 2020 07:45:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61E468015FA; Mon, 21 Sep 2020 11:45:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DFCA9F70; Mon, 21 Sep 2020 11:45:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DBD751750A; Mon, 21 Sep 2020 13:45:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600688725; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nov3hMfz33U+yqvP0A61L4yla7ySq2UFMPH9rNuTgpg=; b=OzUq0XIILqJycXFaAXg44jR4HqGASHUqBXF5QCxCQ+OmmmWEpZ6e+1ioxWNrD0vquBIwDG 6DKR7Agr1h145DkX7hFdtNWMh4/+B5hnUONg2UEVdzbj3vYRT7WA7STXrJm0es4nlqW0vb 4pM2IwMGdHFiT/3hxXnIbRkZB8BSLF4= X-MC-Unique: MXtvkae3MGeYzFaL-lEUZQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 2/2] microvm: add usb support Date: Mon, 21 Sep 2020 13:45:09 +0200 Message-Id: <20200921114509.14511-3-kraxel@redhat.com> In-Reply-To: <20200921114509.14511-1-kraxel@redhat.com> References: <20200921114509.14511-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/21 03:43:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Sergio Lopez , "Michael S. Tsirkin" , Sai Pavan Boddu , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Wire up "usb=3Don" machine option. When enabled add a sysbus xhci controller with 8 ports. Declare it in the ACPI DSDT table so the guest OS finds it. Signed-off-by: Gerd Hoffmann --- include/hw/i386/microvm.h | 5 ++++- hw/i386/acpi-microvm.c | 20 ++++++++++++++++++++ hw/i386/microvm.c | 12 ++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index 27eadd6c535c..e255e787b6d5 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -40,7 +40,7 @@ * 7 | parallel | * 8 | rtc | rtc (rtc=3Don) * 9 | acpi | acpi (ged) - * 10 | pci lnk | + * 10 | pci lnk | xhci (usb=3Don) * 11 | pci lnk | * 12 | ps2 | * 13 | fpu | @@ -59,6 +59,9 @@ #define GED_MMIO_BASE_REGS (GED_MMIO_BASE + 0x200) #define GED_MMIO_IRQ 9 =20 +#define MICROVM_XHCI_BASE 0xfe900000 +#define MICROVM_XHCI_IRQ 10 + /* Machine type options */ #define MICROVM_MACHINE_PIT "pit" #define MICROVM_MACHINE_PIC "pic" diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c index df39c5d3bd90..a2b6c4478f3b 100644 --- a/hw/i386/acpi-microvm.c +++ b/hw/i386/acpi-microvm.c @@ -87,6 +87,25 @@ static void acpi_dsdt_add_virtio(Aml *scope, } } =20 +static void acpi_dsdt_add_xhci(Aml *scope, MicrovmMachineState *mms) +{ + if (!machine_usb(MACHINE(mms))) { + return; + } + + Aml *dev =3D aml_device("XHCI"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0D10"))); + + uint32_t irq =3D MICROVM_XHCI_IRQ; + Aml *crs =3D aml_resource_template(); + aml_append(crs, aml_memory32_fixed(MICROVM_XHCI_BASE, 0x4000, + AML_READ_WRITE)); + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, + AML_EXCLUSIVE, &irq, 1)); + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(scope, dev); +} + static void build_dsdt_microvm(GArray *table_data, BIOSLinker *linker, MicrovmMachineState *mms) @@ -112,6 +131,7 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *link= er, GED_MMIO_IRQ, AML_SYSTEM_MEMORY, GED_MMIO_BASE); acpi_dsdt_add_power_button(sb_scope); acpi_dsdt_add_virtio(sb_scope, mms); + acpi_dsdt_add_xhci(sb_scope, mms); aml_append(dsdt, sb_scope); =20 /* ACPI 5.0: Table 7-209 System State Package */ diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 60d32722301f..592dc51ce7bf 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -147,6 +147,18 @@ static void microvm_devices_init(MicrovmMachineState *= mms) x86ms->acpi_dev =3D HOTPLUG_HANDLER(dev); } =20 + if (x86_machine_is_acpi_enabled(x86ms) && machine_usb(MACHINE(mms))) { + DeviceState *dev =3D qdev_new("sysbus-xhci"); + qdev_prop_set_uint32(dev, "intrs", 1); + qdev_prop_set_uint32(dev, "slots", 64); /* MAXSLOTS */ + qdev_prop_set_uint32(dev, "p2", 8); + qdev_prop_set_uint32(dev, "p3", 8); + sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MICROVM_XHCI_BASE); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, + x86ms->gsi[MICROVM_XHCI_IRQ]); + } + if (mms->pic =3D=3D ON_OFF_AUTO_ON || mms->pic =3D=3D ON_OFF_AUTO_AUTO= ) { qemu_irq *i8259; =20 --=20 2.27.0