From patchwork Tue Apr 16 18:59: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: 789244 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp438170wrb; Tue, 16 Apr 2024 12:01:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXoET2hpqTPsdCErKOCYrdu4QBlX86e4EOEe8gQAVshu08ts60uPJtgU5eDI/OzjLTXiLDrxJRS2WdI0rEmgoVf X-Google-Smtp-Source: AGHT+IElu0u2yW5bjI2TGKiJultYVphuGWx7HaIux63brJjuTPjEFV+72Q4oH4eO6lWP4dAQ6RBw X-Received: by 2002:a05:6102:dc6:b0:47b:9c8e:ca4f with SMTP id e6-20020a0561020dc600b0047b9c8eca4fmr2010134vst.8.1713294094336; Tue, 16 Apr 2024 12:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713294094; cv=none; d=google.com; s=arc-20160816; b=A1+4JydJQ2ZEfGi7bnmbw6GDELEF0lnXkIn8w0Dep94ZvVu+8YefVY4AtedSvpW98S Z5gq6MbFrwNMxkS+gu7ATFS+sav2HeFANRpfFf/uni7zjPuZ8zpwYLikqlwarGhM74Sb 65FP2YGknJMm2JPc0wROdt6vmCVhqRNE7oc87/ybHyir3N2U//8OTJNuzAsDwoBHvX99 KpqV2yam5mmLP32rJeMshdl1wyc7Rfo0O+5bOS5q+Ax0f2/oLexHllAJhwZie4oB9JHO RhA4R3138hTyMS9+5utrLAASVxubrJzIDA8xhCmXLFecx00mzgpDKqo2/1g9qOkQ+Ha+ dXgw== 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=gp8x4TEL4EbNKdvIDh9aTIk1mdHjxl7jHmyUT73tLuI=; b=rE9B1m+pIRX7RpEV6Y+8VBNEoCQYC4IcCaDVKhLZNknyYgW2Nrw3nbn7u3E0j0bA9O bYswYGktIjMn0XM/ykgEmvOOGudS+fHsoo2vQd438x1QMd2+32PkxTbnGUOQZ7Rs1Zx3 LWU+np8LPVy3I76Kzinvg2M6dJ7YKpWPK2LuxQYChNxzDxgw8iLtJUpyRZRA7McFKwHO 4zcqiG1hMuHKiM2RB4HYcV1AQmhss6ajDDblC2SkXqIo1kF599ZrzvmX3Xc5NYjXq7Kr TDlsBCZ+P23h65+3AaKcfc37/vYG2G0EbAPogRlCIdDGOnoHWFvNQhr7lWUJQTg7Pl+8 Zpbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hLqgxtpE; 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 cd6-20020a056102418600b0047a332013c9si2383214vsb.276.2024.04.16.12.01.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2024 12:01:34 -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=hLqgxtpE; 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 1rwo39-0001CI-WA; Tue, 16 Apr 2024 15:01:01 -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 1rwo2R-0000to-6B for qemu-devel@nongnu.org; Tue, 16 Apr 2024 15:00:15 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwo2O-0005Zs-Dy for qemu-devel@nongnu.org; Tue, 16 Apr 2024 15:00:14 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5171a529224so6094340e87.0 for ; Tue, 16 Apr 2024 12:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713294010; x=1713898810; 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=hLqgxtpEB5H4QcbmOK6mXxPG3N0D5AabwrCTq8kBJaeDVVzcw1VaVQmOW31GV3PXOt LtM8t2umMYJ1Ld6mNPxA6qSFpLbf08ZJtiSYmcReQIANih0P5loxPyGoiijrl5JUqung 32McCauMNVBLSKLS+ylf5jVpbavxCL6C1hWbXTcWlHa9VvvUdCOt2aSQuoywGzCrIiVj ygGco1zN89jWwnyDAURbjq8jEOTJlY9qJYxNpOtcc1IZTqwCXH7cW/6l5De9Nrwxo1Wq RcCJz9tYmTpkvvh2ETmN3+UNAsInhenC/nPeLDaylUaFnNj/8iqMveMIkmR3TWqsa43w DD+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713294010; x=1713898810; 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=TM7x80OzTmfsf77QLETnajuKI3H5sCW7FWRDDR9RAbagv7/3AtrmrzT9y61jlLMrTH +yLEGZdmbp1Zcon0KhIeI79+Aj5FNZSnv1BrR/JGA+keMhVz55HCDC0j2MTchujOl+MR n+tcIlbtXP20KzTg4K6b7KHnZeVmXeix2l9h8R/+WhK8X6iKXoCnIIcMv+QX9lUj33kt DAopxj0PCro2emotRhOHGgqEtGctCXD583ih+4+BW6fH1eiAViDVBsiMyusorTNVESnc 9Satv+lNu+2RYoYPPBTJwLACDc62ADuBlnIBYZQuemOXMXAaHzTOkvV7W1Y99Zpa9+DH GmVw== X-Gm-Message-State: AOJu0YyBt5SQ2rF0eWeZMdEjJkhsaG1BbuCx9ySIf37UXzxbrMznUTx/ Ta5NXUUsEWxT2hK0pnBzmqrG2Lr6EOlAV6/63xF/qakBzaUqRuJBRzf0IxZYGAo4QeAp+hjyzDk W X-Received: by 2002:ac2:5544:0:b0:515:bee6:5e8c with SMTP id l4-20020ac25544000000b00515bee65e8cmr7857295lfk.40.1713294009690; Tue, 16 Apr 2024 12:00:09 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id ae12-20020a17090725cc00b00a529aeb4eccsm2558072ejc.140.2024.04.16.12.00.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 12:00:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: "Michael S. Tsirkin" , qemu-riscv@nongnu.org, David Hildenbrand , Igor Mammedov , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Gerd Hoffmann Subject: [PATCH v4 04/22] hw/usb/hcd-xhci: Remove XHCI_FLAG_SS_FIRST flag Date: Tue, 16 Apr 2024 20:59:20 +0200 Message-ID: <20240416185939.37984-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240416185939.37984-1-philmd@linaro.org> References: <20240416185939.37984-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=philmd@linaro.org; helo=mail-lf1-x131.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=unavailable 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);