From patchwork Wed May 29 05:15:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 799808 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp566875wrz; Tue, 28 May 2024 22:17:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUuCmIOasienMUUjtkkJ+0IzpfF9H2s/SeIJAwp14tW0NJBJN4tDJaL56MXv+ui/C10SuMVXno/n8ibGH9HbUB1 X-Google-Smtp-Source: AGHT+IErWvsjc21Kg8/CiXJCK8siTKqyuNZsOKzdfmKc9QDkpsn1UbpM0kULBIqo0E83hJbaqTXi X-Received: by 2002:ac8:7d0c:0:b0:43e:4a8e:9642 with SMTP id d75a77b69052e-43fb0f1215cmr177231171cf.56.1716959829946; Tue, 28 May 2024 22:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716959829; cv=none; d=google.com; s=arc-20160816; b=bCqiJSHUiRn5FWO7L5nIu4HJh9F6J82J5TbgbzhYzciOB3yI4PQTv2Aw6qSxc/cLmR pocTxEM5sIW44eF6Z7uLURln8+b0IPSm8GdzVPQdfRpyDVAPnJfPCxqdbuZ/MwRx0eHD WyUg8HkRwLLNE4Jhqm8H1tv5oX1PBKB4zRmbUYaSYjRwnz9DrAd+5IjCwhoBg32w7tdc p9agBi2Ykosc+ksFNI47fFSuxA6WXhaYU45v4bpnU0C9am1AKcYPDy/4abeLKsbW6oEt ijzLyjav3kSNOjX3urabRq6vKvHzF6yclxgVn9gTPIg9ejbyXTAQ2T8iW68FH0V/SBVZ OksQ== 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:cc:to :from:dkim-signature; bh=r03IbH4Q5jukHMDYRNDrIPnxYvDkdnR4utG+Rvdo7L0=; fh=oSujGHGU6kAtfrTPSJ+sLUg/jC0/xSWRKBD061WPWBw=; b=m3Va0FAIhG9/Ym5UvAG+b2bUaz3Ex12TU+ZMS7iQo07eUa+TmMRTXgfGyp620o0YJu YEwQ8rQzEs1he2PFwu2kQaTD00FsunQI+RiDRVZUXg97tlNlVxA2Zx3iSrSVP6GdhqrF LVMn113UDKYl+pPGv+8y0XQ83NY1Gewc+y+74OD3HSjoZVUnOzB18pXr5Q8aLx5G34BH kNuE3R5kEt/dYzPklkT8SCvlJxUo6ItUEoyrVKGDSG00KvvoFZq1sZYh5EkqXcdi8/O0 +0UhGX1mpmWuw6B352AAXp016rc5cM3mM9Mf5j9Dn01vjr027QokhLvWPRWV5w5YZ4Zh apUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bPOc4D2W; 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 d75a77b69052e-43fb18b1ebesi117942901cf.476.2024.05.28.22.17.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 22:17:09 -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=bPOc4D2W; 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 1sCBfW-0000LS-1n; Wed, 29 May 2024 01:16:10 -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 1sCBfU-0000Kg-Dt for qemu-devel@nongnu.org; Wed, 29 May 2024 01:16:08 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCBfS-0005Pw-5Q for qemu-devel@nongnu.org; Wed, 29 May 2024 01:16:07 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-354df3ee1a9so1536386f8f.1 for ; Tue, 28 May 2024 22:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716959763; x=1717564563; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r03IbH4Q5jukHMDYRNDrIPnxYvDkdnR4utG+Rvdo7L0=; b=bPOc4D2WqTK++5W9NHl62RnHrlfVQ+DAk/fr7iPa5hYz6i7/RJlNh+/juM3rz6dwHe olNhmrEdSCr7WW74pDQyFGDsB7gKgdqJ7IBG25TGcpq9pg7yV3g/zimi1fH6syR91aAs 4ixcrVmwCtg7yumNT16PMyAgVNAAk5KNZsx9WHdE/mLTn+JEUgNMQ4yXTseM4DWmr9Rp MdBaucsNKkhimUB2zTr+qfK6fxcra+PT88PPGJtWEKX8LtIZyTRI5X/shJYOH217HRH0 z2vkuJkcgXOV+uDeaCbyn/I3iMbLIFJNtvRL209RL2/kJirZEhbnK6oV0RbK+EJX1ryp mhwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716959763; x=1717564563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r03IbH4Q5jukHMDYRNDrIPnxYvDkdnR4utG+Rvdo7L0=; b=BfikjJhf4d8bqQrBKi0hxmf89X4itwcZoo/2Ouj6yPSR/UyHFdSkHqMHGzovsjVYyE vMxN+95Gofg3qvD99/buqa6q/P0pY9YrkhWOojlWqynA5jpU8AlgbSP0KaFyw5G2prcB 9aZu1SOg6qLRDKTJnTFNLbkIbbnr8HDBUD+QF4bPH9AUvZEPzVirzGkN/0ZdMYIjatyf 2j/P8Vm1zciQlRh2n6rwkwAuAUYCXEBWG3lWQCKTxVNNhU4zCpRjRUpjAP2t2yoNVTdD RPBs8nTbxP3hJ9VXm5URJBtRl8AnqRZw/+gN1jAqTA/yQJe10c8x/a18VgV8MlYTD6PV FY0w== X-Gm-Message-State: AOJu0YzMK/NT/HRjGtLUhrP0q4NrShCNrZ79FNGuVVY9XuLSlZvtdoE8 Bvc97kL0CVcChs8Tc6xzL42pEd4h145QHlyPEqQVAhVf2OJx3klVQdbeOZkLw6RV6yPyVZ2cw+M 7 X-Received: by 2002:a5d:64cf:0:b0:356:4cae:faeb with SMTP id ffacd0b85a97d-3564caefbd2mr9561959f8f.27.1716959763633; Tue, 28 May 2024 22:16:03 -0700 (PDT) Received: from m1x-phil.lan ([176.187.204.141]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a08abd8sm13636012f8f.32.2024.05.28.22.16.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 22:16:03 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Paolo Bonzini , "Michael S. Tsirkin" , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Zhao Liu Subject: [PATCH v5 04/23] hw/usb/hcd-xhci: Remove XHCI_FLAG_SS_FIRST flag Date: Wed, 29 May 2024 07:15:20 +0200 Message-ID: <20240529051539.71210-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240529051539.71210-1-philmd@linaro.org> References: <20240529051539.71210-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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 XHCI_FLAG_SS_FIRST was only used by the pc-i440fx-2.0 machine, which got removed. Remove it and simplify various functions in hcd-xhci.c. Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Zhao Liu Reviewed-by: Igor Mammedov --- hw/usb/hcd-xhci.h | 3 +-- hw/usb/hcd-xhci-nec.c | 2 -- hw/usb/hcd-xhci-pci.c | 1 - hw/usb/hcd-xhci.c | 42 ++++++++---------------------------------- 4 files changed, 9 insertions(+), 39 deletions(-) diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h index 1efa4858fb..fe16d7ad05 100644 --- a/hw/usb/hcd-xhci.h +++ b/hw/usb/hcd-xhci.h @@ -36,8 +36,7 @@ typedef struct XHCIStreamContext XHCIStreamContext; typedef struct XHCIEPContext XHCIEPContext; enum xhci_flags { - XHCI_FLAG_SS_FIRST = 1, - XHCI_FLAG_ENABLE_STREAMS, + XHCI_FLAG_ENABLE_STREAMS = 1, }; typedef enum TRBType { diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c index 5d5b069cf9..0c063b3697 100644 --- a/hw/usb/hcd-xhci-nec.c +++ b/hw/usb/hcd-xhci-nec.c @@ -41,8 +41,6 @@ struct XHCINecState { static Property nec_xhci_properties[] = { DEFINE_PROP_ON_OFF_AUTO("msi", XHCIPciState, msi, ON_OFF_AUTO_AUTO), DEFINE_PROP_ON_OFF_AUTO("msix", XHCIPciState, msix, ON_OFF_AUTO_AUTO), - DEFINE_PROP_BIT("superspeed-ports-first", XHCINecState, flags, - XHCI_FLAG_SS_FIRST, true), DEFINE_PROP_UINT32("intrs", XHCINecState, intrs, XHCI_MAXINTRS), DEFINE_PROP_UINT32("slots", XHCINecState, slots, XHCI_MAXSLOTS), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c index cbad96f393..264d7ebb77 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -242,7 +242,6 @@ static void qemu_xhci_instance_init(Object *obj) s->msix = ON_OFF_AUTO_AUTO; xhci->numintrs = XHCI_MAXINTRS; xhci->numslots = XHCI_MAXSLOTS; - xhci_set_flag(xhci, XHCI_FLAG_SS_FIRST); } static const TypeInfo qemu_xhci_info = { diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index ad40232eb6..b6411f0bda 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -541,18 +541,10 @@ static XHCIPort *xhci_lookup_port(XHCIState *xhci, struct USBPort *uport) case USB_SPEED_LOW: case USB_SPEED_FULL: case USB_SPEED_HIGH: - if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { - index = uport->index + xhci->numports_3; - } else { - index = uport->index; - } + index = uport->index + xhci->numports_3; break; case USB_SPEED_SUPER: - if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { - index = uport->index; - } else { - index = uport->index + xhci->numports_2; - } + index = uport->index; break; default: return NULL; @@ -2779,11 +2771,7 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr reg, unsigned size) ret = 0x20425355; /* "USB " */ break; case 0x28: /* Supported Protocol:08 */ - if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { - ret = (xhci->numports_2<<8) | (xhci->numports_3+1); - } else { - ret = (xhci->numports_2<<8) | 1; - } + ret = (xhci->numports_2 << 8) | (xhci->numports_3 + 1); break; case 0x2c: /* Supported Protocol:0c */ ret = 0x00000000; /* reserved */ @@ -2795,11 +2783,7 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr reg, unsigned size) ret = 0x20425355; /* "USB " */ break; case 0x38: /* Supported Protocol:08 */ - if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { - ret = (xhci->numports_3<<8) | 1; - } else { - ret = (xhci->numports_3<<8) | (xhci->numports_2+1); - } + ret = (xhci->numports_3 << 8) | 1; break; case 0x3c: /* Supported Protocol:0c */ ret = 0x00000000; /* reserved */ @@ -3349,13 +3333,8 @@ static void usb_xhci_init(XHCIState *xhci) for (i = 0; i < usbports; i++) { speedmask = 0; if (i < xhci->numports_2) { - if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { - port = &xhci->ports[i + xhci->numports_3]; - port->portnr = i + 1 + xhci->numports_3; - } else { - port = &xhci->ports[i]; - port->portnr = i + 1; - } + port = &xhci->ports[i + xhci->numports_3]; + port->portnr = i + 1 + xhci->numports_3; port->uport = &xhci->uports[i]; port->speedmask = USB_SPEED_MASK_LOW | @@ -3366,13 +3345,8 @@ static void usb_xhci_init(XHCIState *xhci) speedmask |= port->speedmask; } if (i < xhci->numports_3) { - if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { - port = &xhci->ports[i]; - port->portnr = i + 1; - } else { - port = &xhci->ports[i + xhci->numports_2]; - port->portnr = i + 1 + xhci->numports_2; - } + port = &xhci->ports[i]; + port->portnr = i + 1; port->uport = &xhci->uports[i]; port->speedmask = USB_SPEED_MASK_SUPER; assert(i < XHCI_MAXPORTS);