From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Thomas Huth <thuth@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Sergio Lopez <slp@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>,
Shannon Zhao <shannon.zhaosl@gmail.com>,
qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: [PATCH 3/8] arm/virt: add support for -machine usb=on
Date: Fri, 23 Oct 2020 09:10:17 +0200 [thread overview]
Message-ID: <20201023071022.24916-4-kraxel@redhat.com> (raw)
In-Reply-To: <20201023071022.24916-1-kraxel@redhat.com>
Wire up sysbus-xhci in case usb is enabled.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/hw/arm/virt.h | 1 +
hw/arm/virt.c | 23 +++++++++++++++++++++++
hw/arm/Kconfig | 1 +
3 files changed, 25 insertions(+)
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index aad6d698412a..7c745fbf8b19 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -85,6 +85,7 @@ enum {
VIRT_ACPI_GED,
VIRT_NVDIMM_ACPI,
VIRT_PVTIME,
+ VIRT_XHCI,
VIRT_LOWMEMMAP_LAST,
};
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e465a988d683..f2b34fd33be4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -77,6 +77,7 @@
#include "hw/acpi/generic_event_device.h"
#include "hw/virtio/virtio-iommu.h"
#include "hw/char/pl011.h"
+#include "hw/usb/xhci.h"
#include "qemu/guest-random.h"
#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
@@ -152,6 +153,7 @@ static const MemMapEntry base_memmap[] = {
[VIRT_ACPI_GED] = { 0x09080000, ACPI_GED_EVT_SEL_LEN },
[VIRT_NVDIMM_ACPI] = { 0x09090000, NVDIMM_ACPI_IO_LEN},
[VIRT_PVTIME] = { 0x090a0000, 0x00010000 },
+ [VIRT_XHCI] = { 0x090b0000, XHCI_LEN_REGS },
[VIRT_MMIO] = { 0x0a000000, 0x00000200 },
/* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */
[VIRT_PLATFORM_BUS] = { 0x0c000000, 0x02000000 },
@@ -188,6 +190,7 @@ static const int a15irqmap[] = {
[VIRT_GPIO] = 7,
[VIRT_SECURE_UART] = 8,
[VIRT_ACPI_GED] = 9,
+ [VIRT_XHCI] = 10,
[VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
[VIRT_GIC_V2M] = 48, /* ...to 48 + NUM_GICV2M_SPIS - 1 */
[VIRT_SMMU] = 74, /* ...to 74 + NUM_SMMU_IRQS - 1 */
@@ -806,6 +809,22 @@ static void create_rtc(const VirtMachineState *vms)
g_free(nodename);
}
+static void create_xhci(const VirtMachineState *vms)
+{
+ hwaddr base = base_memmap[VIRT_XHCI].base;
+ int irq = vms->irqmap[VIRT_XHCI];
+ DeviceState *dev;
+
+ dev = qdev_new(TYPE_XHCI_SYSBUS);
+ qdev_prop_set_uint32(dev, "intrs", 1);
+ qdev_prop_set_uint32(dev, "slots", XHCI_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, base);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(vms->gic, irq));
+}
+
static DeviceState *gpio_key_dev;
static void virt_powerdown_req(Notifier *n, void *opaque)
{
@@ -1981,6 +2000,10 @@ static void machvirt_init(MachineState *machine)
create_pcie(vms);
+ if (machine_usb(MACHINE(vms))) {
+ create_xhci(vms);
+ }
+
if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) {
vms->acpi_dev = create_acpi_ged(vms);
} else {
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 7d040827af4f..338ebc6f97d5 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -27,6 +27,7 @@ config ARM_VIRT
select ACPI_HW_REDUCED
select ACPI_NVDIMM
select ACPI_APEI
+ select USB_XHCI_SYSBUS
config CHEETAH
bool
--
2.27.0
next prev parent reply other threads:[~2020-10-23 7:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-23 7:10 [PATCH 0/8] arm/virt: add usb support Gerd Hoffmann
2020-10-23 7:10 ` [PATCH 1/8] tests/acpi: allow updates for expected data files Gerd Hoffmann
2020-10-23 7:10 ` [PATCH 2/8] tests/acpi: add empty tests/data/acpi/virt/DSDT.usb file Gerd Hoffmann
2020-10-23 7:10 ` Gerd Hoffmann [this message]
2020-10-23 7:10 ` [PATCH 4/8] arm/virt: add device tree node for xhci Gerd Hoffmann
2020-10-23 7:10 ` [PATCH 5/8] arm/virt: add acpi dsdt entry " Gerd Hoffmann
2020-10-23 7:10 ` [PATCH 6/8] tests/acpi: add usb testcase for virt Gerd Hoffmann
2020-10-23 7:10 ` [PATCH 7/8] tests/acpi: update expected data files Gerd Hoffmann
2020-10-23 7:10 ` [PATCH 8/8] tests/acpi: disallow updates for " Gerd Hoffmann
2020-10-23 11:36 ` [PATCH 0/8] arm/virt: add usb support Peter Maydell
2020-10-26 7:01 ` Gerd Hoffmann
2020-10-26 9:57 ` Peter Maydell
2020-10-27 6:56 ` Gerd Hoffmann
2020-10-23 16:03 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201023071022.24916-4-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sai.pavan.boddu@xilinx.com \
--cc=shannon.zhaosl@gmail.com \
--cc=slp@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).