From patchwork Tue Jul 4 16:36:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 698970 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp2364955wrs; Tue, 4 Jul 2023 09:38:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1tzBgFNmnsWYQXPeQu5YJY2/XkkqGgows/tju621SSvxbZ3i+MLbzYRFfp6Jd29YU/X4w X-Received: by 2002:a05:622a:4f:b0:3ff:2a3f:734f with SMTP id y15-20020a05622a004f00b003ff2a3f734fmr19229397qtw.11.1688488722510; Tue, 04 Jul 2023 09:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688488722; cv=none; d=google.com; s=arc-20160816; b=I/MClB70SMalAC6UIkdbaHwbL6Iv/1TInkQIq2UcZKgZETlnyFVlawYeKFFRG3TWO8 w0Yoa/LSZiyBaA3VYJsd8tFonr9/uh4e3/JipiEoLd0vH7H/niTdXrBjN5/IGIs8TstM dpnhNTIZUSC0Lxp+NnmTA2vFTaSCuMkfFiRAgDEAmkM6qB9FGwzBj79kVazTM0p1dqOF JjPMbGOEuJs2ePGPTcsXGZZ7B/MnLTruhnABlmVUkYJIfkfd0/KHnQX1bt4oYTsv1sSa ZG0F/R/J9XhjYPN7f11cHUkwlf4e91VC/Rb658w3F1AeMFonL+Dd/AECIgbJAPHg7dsr dcxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xgCaPGnXl46UU9A6jcwSSpnZq6M2JkIzMN4VboZNQHE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=J7bOSPRGbErV5tgimAdToC1Tt0VpeD8mmLtBFf15RJVHr4ZzkHyJydwITOPjezMMmE ob+Dtr+gkoTvpH+nidEh5Qehfxg2H3pyE5hqWN5jnj3OCZoIB4XBz6klAQVfafjD4KGI oGzfy31kcfF3x+zsyc+V4oV3HC8P6qswmDZyivaU2GwYtWXbxixP5SChl9hhwYAm+piq 9WUgqGeEw/St642VYMha0zXzCJ1NwOAygunSU4AcOln47KyMDv+gsE96rbAugNRhxqLw YepNP3R8ML7KVZx43nkp4Ml9kgETXK1qVmvmpD2uIGHs6PW+nX+I+z0MToxq7Bd6lELQ zgHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SDuvYv8z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v4-20020a05622a130400b00400916ca8a4si13657902qtk.353.2023.07.04.09.38.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jul 2023 09:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SDuvYv8z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGj1D-0001Ii-5O; Tue, 04 Jul 2023 12:36:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGj1B-0001HO-J6 for qemu-devel@nongnu.org; Tue, 04 Jul 2023 12:36:45 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGj14-0001nn-6W for qemu-devel@nongnu.org; Tue, 04 Jul 2023 12:36:41 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3141c3a7547so5961608f8f.2 for ; Tue, 04 Jul 2023 09:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688488596; x=1691080596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xgCaPGnXl46UU9A6jcwSSpnZq6M2JkIzMN4VboZNQHE=; b=SDuvYv8zZq65Gg+CrFMlDVf499JnmegaJ7AZOtsSndelw92DsGOIb/OzS3WQNhG392 mQQns5mqJpsaILgi7Db3bqhC4L0d4Wd02NVtXmvYEJnONz1SMpIgusZ/kXneXGWAgRnE 3qZZrV+9g/p78kwVQhXs2hs9E2lxzaRxAvQLix09412JUzytoF+ZvmPWU9sbKsHLz+2t fcegYUH1ZwRu/bOr4pov6OWnYKf2ADGhTU5qwcaNTCPQ/pLgtFobWaTooJY+6lCcMEqA NdBk8hZ0A+jmrw+slAPDjqUU9g56c+6lFYxxCS2EEmCR9sHbCQEC6DgYUSaBhzznv24P fYiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688488596; x=1691080596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xgCaPGnXl46UU9A6jcwSSpnZq6M2JkIzMN4VboZNQHE=; b=LodP/qTEifm4NPFUIOot2fZgx0qRnk4X5sYU2RuMZryy3euaR4yu/avGSxex1PzSLn HEQDsMLQgwwl9zJzdgMd07/Y8okyyo8DShZAbWXMV1K7We9GQKTDUae+hJQG1CgzxqOj 2AvZgtpiLkYW7bndkkfBnHevmP2jfZe/h91+XwsaLD/1W2lCyId0pwTEf6x/URYk536x ENVGLjca3SVkeihjZpfWmPTf+C0sTylUOXiwzm9OFRMV+uoMawE/iKmMVEDdP1v1Y1zy EvX7o+q/xrddZ4wjCaVtZRSbaNhvPpyQWeX0SQvlHxWiS48pkJF1cu7yaMgJX6HRbY// /Zgw== X-Gm-Message-State: ABy/qLaCD//WGjQqhzXV2wh7VxMaWGShmSFXyS6RELulCEr4GdFbFiGn LLmYJGVe1qWTJmJA+jDFwoyNj7pG0mCsB7AkSqo= X-Received: by 2002:a5d:62d1:0:b0:313:f38f:1f4e with SMTP id o17-20020a5d62d1000000b00313f38f1f4emr10358292wrv.27.1688488596617; Tue, 04 Jul 2023 09:36:36 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b003143b032b7asm4354258wrx.116.2023.07.04.09.36.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 09:36:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/11] hw/arm/sbsa-ref: use XHCI to replace EHCI Date: Tue, 4 Jul 2023 17:36:25 +0100 Message-Id: <20230704163634.3188465-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230704163634.3188465-1-peter.maydell@linaro.org> References: <20230704163634.3188465-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Yuquan Wang The current sbsa-ref cannot use EHCI controller which is only able to do 32-bit DMA, since sbsa-ref doesn't have RAM below 4GB. Hence, this uses XHCI to provide a usb controller with 64-bit DMA capablity instead of EHCI. We bump the platform version to 0.3 with this change. Although the hardware at the USB controller address changes, the firmware and Linux can both cope with this -- on an older non-XHCI-aware firmware/kernel setup the probe routine simply fails and the guest proceeds without any USB. (This isn't a loss of functionality, because the old USB controller never worked in the first place.) So we can call this a backwards-compatible change and only bump the minor version. Signed-off-by: Yuquan Wang Message-id: 20230621103847.447508-2-wangyuquan1236@phytium.com.cn [PMM: tweaked commit message; add line to docs about what changes in platform version 0.3] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/system/arm/sbsa.rst | 5 ++++- hw/arm/sbsa-ref.c | 23 +++++++++++++---------- hw/arm/Kconfig | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst index a8e0b530a24..bca61608ff8 100644 --- a/docs/system/arm/sbsa.rst +++ b/docs/system/arm/sbsa.rst @@ -19,7 +19,7 @@ The ``sbsa-ref`` board supports: - A configurable number of AArch64 CPUs - GIC version 3 - System bus AHCI controller - - System bus EHCI controller + - System bus XHCI controller - CDROM and hard disc on AHCI bus - E1000E ethernet card on PCIe bus - Bochs display adapter on PCIe bus @@ -68,3 +68,6 @@ Platform version changes: 0.2 GIC ITS information is present in devicetree. + +0.3 + The USB controller is an XHCI device, not EHCI diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 82a28b2e0be..1a8519b868f 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -42,6 +42,7 @@ #include "hw/pci-host/gpex.h" #include "hw/qdev-properties.h" #include "hw/usb.h" +#include "hw/usb/xhci.h" #include "hw/char/pl011.h" #include "hw/watchdog/sbsa_gwdt.h" #include "net/net.h" @@ -85,7 +86,7 @@ enum { SBSA_SECURE_UART_MM, SBSA_SECURE_MEM, SBSA_AHCI, - SBSA_EHCI, + SBSA_XHCI, }; struct SBSAMachineState { @@ -123,7 +124,7 @@ static const MemMapEntry sbsa_ref_memmap[] = { [SBSA_SMMU] = { 0x60050000, 0x00020000 }, /* Space here reserved for more SMMUs */ [SBSA_AHCI] = { 0x60100000, 0x00010000 }, - [SBSA_EHCI] = { 0x60110000, 0x00010000 }, + [SBSA_XHCI] = { 0x60110000, 0x00010000 }, /* Space here reserved for other devices */ [SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 }, /* 32-bit address PCIE MMIO space */ @@ -143,7 +144,7 @@ static const int sbsa_ref_irqmap[] = { [SBSA_SECURE_UART] = 8, [SBSA_SECURE_UART_MM] = 9, [SBSA_AHCI] = 10, - [SBSA_EHCI] = 11, + [SBSA_XHCI] = 11, [SBSA_SMMU] = 12, /* ... to 15 */ [SBSA_GWDT_WS0] = 16, }; @@ -230,7 +231,7 @@ static void create_fdt(SBSAMachineState *sms) * fw compatibility. */ qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0); - qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 2); + qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 3); if (ms->numa_state->have_numa_distance) { int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); @@ -604,13 +605,15 @@ static void create_ahci(const SBSAMachineState *sms) } } -static void create_ehci(const SBSAMachineState *sms) +static void create_xhci(const SBSAMachineState *sms) { - hwaddr base = sbsa_ref_memmap[SBSA_EHCI].base; - int irq = sbsa_ref_irqmap[SBSA_EHCI]; + hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base; + int irq = sbsa_ref_irqmap[SBSA_XHCI]; + DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS); - sysbus_create_simple("platform-ehci-usb", base, - qdev_get_gpio_in(sms->gic, irq)); + sysbus_realize_and_unref(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(sms->gic, irq)); } static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) @@ -832,7 +835,7 @@ static void sbsa_ref_init(MachineState *machine) create_ahci(sms); - create_ehci(sms); + create_xhci(sms); create_pcie(sms); diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 7de17d1e8c3..7e683484405 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -266,7 +266,7 @@ config SBSA_REF select PL011 # UART select PL031 # RTC select PL061 # GPIO - select USB_EHCI_SYSBUS + select USB_XHCI_SYSBUS select WDT_SBSA select BOCHS_DISPLAY