From patchwork Wed Mar 27 09:51:05 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: 783108 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2107391wrt; Wed, 27 Mar 2024 02:53:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVidkCC4S0pLMRVcpkGqnYwp1ARBfAHtHBfMbTE5NQ380e2NBw344lHgJw1+1NzOHEjvhaW/S44JW1uZaKTuj01 X-Google-Smtp-Source: AGHT+IHNb7sSCLuz4MefiyMqeHFQfn4Jm+VluR337Op3DtC7MiOWldVkPkfvhZOQiqNTw7oSQ+1s X-Received: by 2002:a05:620a:5e07:b0:789:e3ee:532c with SMTP id xz7-20020a05620a5e0700b00789e3ee532cmr703411qkn.26.1711533220202; Wed, 27 Mar 2024 02:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711533220; cv=none; d=google.com; s=arc-20160816; b=tor4MvOlVlTN9DBzWYSz6KGPw6rD/UIWU9xiEZ5ajOn0PFlc5CI+hYV2MkdwaTsQC+ BSrDyUz6Of6hm2cAkRBNIhOZFB/yGy1+RXi9fyfB5LoeZQdgIXCg8NBRD8M6FRVJuIY1 5M9el3+sA+2nRIcPX1y2s9un8lhwJVB7AroFtj33fhVDxogMNfPOnR4gqbBJkSek689z 7DBznedgsjCCkNvgLmOYgXCklZSJOhBvfZW+JlVPHBjyNNGP9g1u0DcM991IlS3MdtKI CqqpPpfLEwqzyNehTIvXnAIU8Rzlt1OPd0sCd83KyXawZjytfGZ4Z4oaJ7Y32GBtGbjI T1FQ== 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=lfnexeanp2sgT0hsw3byAGvWLRwN/Jj6s1AZCFW+ugA=; fh=4YeD3BMkPEX4PvfiCR5lvDSUSZ8MiKsUz4smwZVqLug=; b=Z4qZE4tHwT5RRVlS8gC/JEqTYhQ+rYxZpZ9Le2TJC+MX30jsFeFFeYSN9w3trDD6QF /jZGQB76je8C0yzgk/YJkoEMllA1HYMt+ivJNhdSgs5bJgj3OSBp3c0n0YDzP7kwmr/D fKNHiN321qUm/sz3hpBAn5jcE5cxAmKGLD0Yn67dqMIUQ/eWRuj+W/l+/gGSgd7gV9rH mxHuvWzBwoOTxEYMiP0BtbPKn6K/Xn5CVZCVKWBywyV6si6TtyG9uELB9nhM+3gvdjKQ BkLCpATSphE2g/JQo5dkI4jZzk2CHfCAWCRmg3FB+bSXaoxjrSuDgpqqmxsIpW3I35AW ii/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bvxke30T; 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 z26-20020a05620a08da00b0078a43d4b8basi9415260qkz.193.2024.03.27.02.53.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2024 02:53:40 -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=bvxke30T; 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 1rpPwm-0002Iq-D9; Wed, 27 Mar 2024 05:51:52 -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 1rpPwk-0002IE-Ch for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:51:50 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPwi-0006i4-2F for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:51:50 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56890b533aaso7620889a12.3 for ; Wed, 27 Mar 2024 02:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711533106; x=1712137906; 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=lfnexeanp2sgT0hsw3byAGvWLRwN/Jj6s1AZCFW+ugA=; b=bvxke30TIo/nbOXVP6SezUEDRsHJwNgoIkrLdGcNuYLWzF/0FZHE9j+FDft53DAYen dk1xGC/wivCuYDoYROhWeqYYAUeG5Rg/27yCU5Yl1AVzGNqIQbhcyc/KNNaZdAOAKywO iakZXt2pFkmWxmo9OeC/q0Kkln2G2KHdfvu8c4lt8sWY8WN9IVIIZL9tEaGWL//3UBuz TdytpRCKEN/NnyQR3zTUupWMZ6CUpbBRNtFSI4dawVBS0YJoxYYdNEJKskrJdLqTAYjE wYqkessAwsxTYrsfmaOlYzlEylRSzSY8DIxgtSdApoInJyT5+EqjtJcaLFCyEYtbAyHU Efhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711533106; x=1712137906; 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=lfnexeanp2sgT0hsw3byAGvWLRwN/Jj6s1AZCFW+ugA=; b=YUPLque9srQg6oWk2l3W4uPAIr/R0tbWo68gIJGdsJTBDThKboF5HuZD0yZtEJy7yJ bkkl10TRSzU2b9MKTWyaHislfXyXH/zR/WFegZXBd77BJN9kW+X3UCQ/1KyhBYHrqnb4 QlHElmN74z/V2uKRtxWdyZBd3bYMLu69OI4NB2WHcbBlFCuDwxCz2+IrA9X0mHlfYrRk VwEOabLy6WkBqzj9R3bYXi73RB1zt0uogc3zdh2hppdCVPQPNkjTAAC5JzOK7RvIBxqu /s3nRaMk97vWaxUrEMMgntfRHPeWDqcob9KPD9B/ot9agyGMShAOJpKVG8sYwvRLzPrP Nvjw== X-Forwarded-Encrypted: i=1; AJvYcCW/0K/b/VkkHw52SQUH70AfPRgps60H+QlxT7oEE0H7nO6tehqxhpa8DgCA5tmCNN4Zips0+Y1xz3QGhthxbFQP9QoS+Xo= X-Gm-Message-State: AOJu0Yy+Celwvk4PBOrxaWxEyxW1Yf0ffVUlL5jtutD3iwyxmvYzlACA DHb4J2cRc8MxAm1r8uq6UlyAKQ/XxF1yJi2g8cjHXkndeEX2WZJ0Dx/0Hxxklow= X-Received: by 2002:a50:9f27:0:b0:568:d7fe:a857 with SMTP id b36-20020a509f27000000b00568d7fea857mr568657edf.11.1711533105386; Wed, 27 Mar 2024 02:51:45 -0700 (PDT) Received: from m1x-phil.lan ([176.187.205.175]) by smtp.gmail.com with ESMTPSA id eo3-20020a056402530300b0056bf66a0c36sm5005218edb.58.2024.03.27.02.51.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 27 Mar 2024 02:51:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Thomas Huth , qemu-devel@nongnu.org, Igor Mammedov Cc: Paolo Bonzini , devel@lists.libvirt.org, Zhao Liu , Gerd Hoffmann , "Michael S. Tsirkin" , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 03/21] hw/usb/hcd-xhci: Remove XHCI_FLAG_SS_FIRST flag Date: Wed, 27 Mar 2024 10:51:05 +0100 Message-ID: <20240327095124.73639-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240327095124.73639-1-philmd@linaro.org> References: <20240327095124.73639-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 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 --- 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);