From nobody Wed Jan 8 03:16:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1733685549; cv=none; d=zohomail.com; s=zohoarc; b=aTTSu0TiKQ3NOfocMPZBW45LQ0WyardjYYY+CfFis1VQLDURCIuyr9rqLUL3M9MSaYZ2vAbuYcT0Juweson2X1jkcGuDC7/EhDjOh6s3/Mn5lJJlviWRv2WBka/13fp58pJkzvRVeqqmj0V6i7Ry/5X/OkMX6JIku/4VP9cjYOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733685549; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=h3BoSGB7P8OJJqEoTDM7+AVqy5XBZWcK8vMNoo4I1hk=; b=G2qHaKi2sMM3jTCkWcmM3N7x+h62ZUJX+aPR+cM4wJzg+JB1khqk0LT2Z4rPcMKFRAfzTsmr2inL6C+8wRIAbw1yZI7sGIgwsmpgUyvH1h7c4uzHzEyr9UTK082El/v4G9NWTIm3G3fn7ZE4Rz7GPAP5lirIeO11+CPSHJ7vpJs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733685549378271.16650422387863; Sun, 8 Dec 2024 11:19:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKMmr-0005JP-N2; Sun, 08 Dec 2024 14:17:49 -0500 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 1tKMml-0005Iw-NV for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:44 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKMmj-0001Vr-R1 for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:43 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-aa560a65fd6so669634766b.0 for ; Sun, 08 Dec 2024 11:17:40 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa665119a06sm240350866b.121.2024.12.08.11.17.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 08 Dec 2024 11:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1733685459; x=1734290259; 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=h3BoSGB7P8OJJqEoTDM7+AVqy5XBZWcK8vMNoo4I1hk=; b=1Gl3W/s3JXNjoVatDL29lRWGP2JPG+O4N7zWNk340QQbipXeuQbr9WtRGpgRp23RvW qOP/VaQ+Q8Zye51IQAoOC7p+KwBRDSlK3XB3W36DPY6n0E4BhGdT9+L7vbbHLDlEDsZv uO+RHvHyw+N4TM9JBS1D93qknQTmRrpODW3lBhwy8voPDD0BBWmdDPEkyCAcSSBKetjS zQZMY0+OzKAE+SuB3t/i4xTm5fkGR+fXpTvB+A3stVb1FaIGESv9sdr6OjNBhrrkoT/C 7EkWaLR2IqV585vkOVLmK0by/beOeaZFo+BIH2OZo2StO3AZnYxq0zeA2zGSf+p7Js+l C/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733685459; x=1734290259; 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=h3BoSGB7P8OJJqEoTDM7+AVqy5XBZWcK8vMNoo4I1hk=; b=LWBwkm8rNJ/CXVH2z4oWCQTcqTbjRUcpQ4+Wv+L3yN1GXqwjzLd5xeePMk7jB125HN UztRZ8vMrUJUrqhTd659ek3i1zZLK9z++spSgssPaEM0MCYa5wdbBmnK+r6Eck4+AJ1+ 8Co2QHoOcTscjG6YWD3sAmY3j9RMvs8Ku6AU8IeFYZd0htXLQ3PEHd5WYDiNWbjsiwVE hVvzvgKeT1e/A8qn7a9UF+lu/nDJ0gV0bIHlZJwoR5qUbEgHFcA4mj9DL8SX7QQH5w+U B4QXCqztM8SdKdVxE+oQhatiw5fOXTRIhXjwT6LVGTA7nWt3wDJotTXgVcNb8OMqLXLc frrg== X-Gm-Message-State: AOJu0YxMt00LkTodXMwbK8AT4A0gBBTf7KyXkMtj5SVyhBV2AW4D5mAl ztbHog6tr4iBNE1sx+KhquwRmel/mcNYsnPvbuLDSLkL0Qj903e1v3SLgLO69XM0HRhR2MkXy+X eLw== X-Gm-Gg: ASbGncuNG62vppSO4AMKG2bedSzXQ1DvVQDkJ+wOTc63166EAHUmDefH4PDbrFIbjyL GcR+UI7K0xmujQ+TryllDy5ooQe+PBcGcJFJ5hmE3WRIuYNNFa0egEQDl4T+iKbqA17CT2ML6/v zdnsB6gj+ZL1j7Tk7etsap1FLux7AW55xWoJxMJSdAB73c1LqCkZZ/F0JP8HVJuHRU0lRyuCiqE k7fvCJPO5ZnqKwlHLESFKNO6zafLO6ARcnlkH8lnJACLAtNyrw3uSRKH0pwZSGTX/sMhzjGRLZ6 pA6N41KLs4cFlSsbcFk43v4sSg== X-Google-Smtp-Source: AGHT+IHaYl5CqQoxB+CLjhFxgkNPtEow3xA0EplaiR3IpyclqIxYyKoLa+w2uJiFDLFVpAecQqzhbg== X-Received: by 2002:a17:907:950f:b0:aa6:6ca2:b774 with SMTP id a640c23a62f3a-aa66ca2b86emr434968366b.6.1733685458900; Sun, 08 Dec 2024 11:17:38 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, philmd@linaro.org, thuth@redhat.com, zhao1.liu@intel.com, imammedo@redhat.com, akihiko.odaki@daynix.com, Phil Dennis-Jordan Subject: [PATCH 1/6] hw/usb/hcd-xhci-pci: Don't trigger MSI on higher vector than allocated Date: Sun, 8 Dec 2024 20:16:41 +0100 Message-Id: <20241208191646.64857-2-phil@philjordan.eu> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241208191646.64857-1-phil@philjordan.eu> References: <20241208191646.64857-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::62d; envelope-from=phil@philjordan.eu; helo=mail-ej1-x62d.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1733685551974116600 Content-Type: text/plain; charset="utf-8" QEMU would crash with a failed assertion if the XHCI controller attempted to raise the interrupt on a higher vector than the highest configured for the device by the guest driver. This change adds a check so the interrupt is dropped instead of crashing the VM. Signed-off-by: Phil Dennis-Jordan --- hw/usb/hcd-xhci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c index a039f5778a6..376635e889b 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -73,7 +73,7 @@ static bool xhci_pci_intr_raise(XHCIState *xhci, int n, b= ool level) return true; } =20 - if (msi_enabled(pci_dev) && level) { + if (msi_enabled(pci_dev) && level && n < msi_nr_vectors_allocated(pci_= dev)) { msi_notify(pci_dev, n); return true; } --=20 2.39.5 (Apple Git-154) From nobody Wed Jan 8 03:16:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1733685526; cv=none; d=zohomail.com; s=zohoarc; b=MetVmOnM8Y47IjM/bBLC6r0pFmciza/8YmVfYDSQQ7/6H76gleaUXzXyJWF9PM/10rel1uwjLvmPGTOEjeMtBP7CBllGGge60EWX+tihjVeO2bz4iagdb1sEuSEVWkLduPIO4WjPDaFrOg0dztBWNOEPePDOltYi0Mg75R14xXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733685526; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZDLwO59qMJIads3fEO76SDUFkR5YOH4ziTSFt3LfxpA=; b=ecc+ggzOxwNPlSggp9PAPh40eCx6eMKpaQEUYgzCPxl62DqIRwjry8zcfHAE1OSjZHS7Ki7zklY0GT48oqS3e0MIsUVT8vySgP+NPCKx9qHNdFSwb2v7iV3X+xwb6oj+te0bul8jRf7X/pj/xBw5vUsUrR7G+cMoknp6FQxG2P4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733685526119537.4916316884794; Sun, 8 Dec 2024 11:18:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKMmu-0005Kc-Cs; Sun, 08 Dec 2024 14:17:52 -0500 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 1tKMml-0005Ix-NY for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:44 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKMmk-0001Vx-1B for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:43 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-aa5325af6a0so568070666b.2 for ; Sun, 08 Dec 2024 11:17:41 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa665119a06sm240350866b.121.2024.12.08.11.17.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 08 Dec 2024 11:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1733685460; x=1734290260; 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=ZDLwO59qMJIads3fEO76SDUFkR5YOH4ziTSFt3LfxpA=; b=sC61SZWFa5egoTTtR89TGWcbt+Ym8F7RSF/+Jaf019tZMs9bi2uw3uSZCjlMGqQFAC FpDgFs9U5NZDX0eU0ifV/22pGgD1p1VdIFfnq9E/e7Vb00y6ve1msaA8mnbnMZlcnzPr JGYMGNnrjt5D23tQ4G2E0svhbdSA5Vk9iKHezdJnpLusBDebKW6zSqaLTGuaNpnCTS4a Dx3QPYm8Gb46xvZFyCbThPkjoI85sEsVtwxsMg/+7vpLXYmopNTqBFI5JBlTS0Xww906 PQP7bCv/7feFTtwOBgIeDWOrjEdYaBeo1JrQEIp2Vv0BuswEXyody1Cpi5Jie/jNaAk/ Erow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733685460; x=1734290260; 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=ZDLwO59qMJIads3fEO76SDUFkR5YOH4ziTSFt3LfxpA=; b=KAOiTHsRmNI/lRNdFzAZ5/4f9pIlxVJOpZWvD7twNRyHc80+NnQR7ZjqBcZjqDuboZ xnVnh6gGBiBr4IbWqOCNaAPMeGzf3Y9/rFWcNwffaYYtRp3M+vrmN9OccrJw1YenDrJ8 HpAZX5hjpn4YMrGMGGATW4a2EfHdxbia5VdlSBUQIDYlFs1QjCkKw+9Em8uvQc5kRanm M1gLqhqQDfc+3UL9XhzfHiF4nv4xnANOICWYPR9OpFy1qSVu7Q6XuMqscB+WJAbb3x8p ZTFq6/Chsm4yf7uLAp6Z+/kpsU7N+TOiGZrcRuIAD0iHQbkvsu3cl9adt2RPSGifC5v2 nuoQ== X-Gm-Message-State: AOJu0Yzm4YtIp+435imT4/iagTNg92tC0kXa6g4oZ8xnmXtv+c82e/9f 0bfIEgcz6FXBzexqCeKe/p+hD0EOmTR8WYP2JTBlktfGCUit4pt078PrySWyuBz/mRc1AdHT7EQ GEQ== X-Gm-Gg: ASbGnctY//VZASMBwylOtXeZ/A+cYa9d2GpvLzvXky+N1FONsEzTi4HO+/cobS2RgHK xPbAsL+0e8kucmoGLwH2qyuAxMTrWjCQ53noW9xS6jQGcHx2BmX3r7SWZyKTnloHUZWes0cFub1 ak1vf08fSCEfCOgHFLahEO2fgRSdQqsjF9WVWnSRShHFhtEuaiw/dWSv7UKnlk3JxmxIqzc7tcj c8u2vkUMpFnEZcaXelpDB/+Yo9dsvWDWjqHTltnQqk4+znDHcXiWWXryRPgwdS2x7nw3ROB8eP6 Za2EGCpwJCo0W6+vIEXBNWWm3A== X-Google-Smtp-Source: AGHT+IGSUTH0PqdBxOdEhYLxFUrd1SQgJvDp6AJd5F8+uJE77vebklbh+La6rdOxo8r5J/NYYXmHjw== X-Received: by 2002:a17:906:4d1:b0:aa6:19c9:ad08 with SMTP id a640c23a62f3a-aa63a20d60bmr876454066b.48.1733685460493; Sun, 08 Dec 2024 11:17:40 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, philmd@linaro.org, thuth@redhat.com, zhao1.liu@intel.com, imammedo@redhat.com, akihiko.odaki@daynix.com, Phil Dennis-Jordan Subject: [PATCH 2/6] hw/usb/hcd-xhci-pci: Moves msi/msix properties from NEC to superclass Date: Sun, 8 Dec 2024 20:16:42 +0100 Message-Id: <20241208191646.64857-3-phil@philjordan.eu> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241208191646.64857-1-phil@philjordan.eu> References: <20241208191646.64857-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::62c; envelope-from=phil@philjordan.eu; helo=mail-ej1-x62c.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1733685532493116600 Content-Type: text/plain; charset="utf-8" The NEC XHCI controller exposes the underlying PCI device's msi and msix properties, but the superclass and thus the qemu-xhci device do not. There does not seem to be any obvious reason for this limitation. This change moves these properties to the superclass so they are exposed by both PCI XHCI device variants. Signed-off-by: Phil Dennis-Jordan --- hw/usb/hcd-xhci-nec.c | 2 -- hw/usb/hcd-xhci-pci.c | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c index 0c063b3697d..408bf065e5a 100644 --- a/hw/usb/hcd-xhci-nec.c +++ b/hw/usb/hcd-xhci-nec.c @@ -39,8 +39,6 @@ struct XHCINecState { }; =20 static Property nec_xhci_properties[] =3D { - 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_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 376635e889b..0278b0fbce2 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -197,6 +197,12 @@ static void xhci_instance_init(Object *obj) qdev_alias_all_properties(DEVICE(&s->xhci), obj); } =20 +static Property xhci_pci_properties[] =3D { + 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_END_OF_LIST(), +}; + static void xhci_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); @@ -208,6 +214,7 @@ static void xhci_class_init(ObjectClass *klass, void *d= ata) k->realize =3D usb_xhci_pci_realize; k->exit =3D usb_xhci_pci_exit; k->class_id =3D PCI_CLASS_SERIAL_USB; + device_class_set_props(dc, xhci_pci_properties); } =20 static const TypeInfo xhci_pci_info =3D { --=20 2.39.5 (Apple Git-154) From nobody Wed Jan 8 03:16:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1733685531; cv=none; d=zohomail.com; s=zohoarc; b=HnvBpVhMCeep89pmyU3+iuHXHd9j1IMiAVHNrfDaXSiNC4flLZd41ueChs3a97kh4QT8m+r4cg3HaTNPPvqOartdrdYk/7eZaNqO+m83LWSTl9fM8M9HKA83gnDX5yFVSU6NeVGuu9QgR9iqjkLIpNFS9O6fgP8dTymXlE8g3Bg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733685531; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=acRq5wtuEZY6qfWLgIt8kj488PEzJr2oq6KQkbWz1tc=; b=hGkcRJ2+NAXPAV3/NyLG91Jx2j6moYcrDcVMm2gnaJf9YMulBrhYD7X35/POMEF+SD+dairuEer6EBTeCYucvN8UDsZYk39dCHYqo6ARs5pD55e/ECo6PbgT8VFSkXA8DffZ4cSG49jQHYgJpS735d6hDLB0tV9BlNIMCdMg3xM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733685531245526.3014340147683; Sun, 8 Dec 2024 11:18:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKMmw-0005LG-Jz; Sun, 08 Dec 2024 14:17:54 -0500 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 1tKMmn-0005JN-Kf for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:49 -0500 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKMml-0001W4-Mh for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:45 -0500 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-aa5ec8d6f64so419952366b.2 for ; Sun, 08 Dec 2024 11:17:43 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa665119a06sm240350866b.121.2024.12.08.11.17.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 08 Dec 2024 11:17:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1733685462; x=1734290262; 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=acRq5wtuEZY6qfWLgIt8kj488PEzJr2oq6KQkbWz1tc=; b=S+wy0mgvIYaKjcW+j+MllyZmeGgpkZ0Y04Png2xNe2EC6rBlFk09lB14hw40EvV0Ps NhIz00gKoVeLwo4HRRnk63G0MPjVSOc/mdOtcDeHcCXJZJyr6K/c8UQZdV+CryABZuM6 oN6e6xemcpNIAutEnL6IrGGQYcPeVpMxRZBtKzVc7Mz4+4MYcEiohmq57VK13E9NbRlS MV6TxoVu69hP+ciYy1nDnbrhKxY/sqsLZV8GhDMwWBPUqsQn5dx5K0UIjsSxN2K4Ffrx +RqZde41T4oma+V/a3gptBgpfDdNnUNU/dMG55K/w+XuhP7RG0Z4gMAbWlVMagcTyDN6 Oopw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733685462; x=1734290262; 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=acRq5wtuEZY6qfWLgIt8kj488PEzJr2oq6KQkbWz1tc=; b=DhQlHFAJPKfsIsgS+fP5UdPJPTqPFmvYtbu3hSuC9d2ldmPST1Vu2qUhwe+pwAUay0 +GFzqJcyTOvLXCC/Q5xo4BLf2I8ZTpS6yFt3XbdCkc1fKHrgNw38OzOG3OaOtq1J0PYW jIQDNjPmaEQJCrVcIPqW7VOZ/FXruZ5Q0ICm7U8+JaNOpTdfsW24S8D5+O1z+L3qIiBt 0mU1BOk9voSV/97e8Sg5eqUrt2xKlLoXeRJK6LGhLRcF9rJjY1tT/6aQJif9Rw7EWxKC r5Mc2tYM48iwKgvZbU34smwEEue8Ngu78tGqcf4LzK2xdLwNkLnNpw7UrXZSq5eZaMq/ 62AQ== X-Gm-Message-State: AOJu0YyjHQFlJ3RZRhwvRPWa6cqkyGfaaY2WHDkA+sDMYrF9nMNgPItH gkaWA02aC9iH3mIvKmVh3yzgtqMBQNbIy9PW+4rvDE2nV0ZVJKvqe29wz0XMG7hxcJLPhmpbPsX I7g== X-Gm-Gg: ASbGncucUnU+cSZ7TJx9vfQ8KDmpoHuiV43tbJ4mE4UBPtg4r7aO1VIBd3JRBFpqsV0 yDCJRAVFYodqNaCvgF1lTTwuMkBvpvb/yAZymTAYSEld5HyPgYIdse0/2XptcpYRZbLBTU2MHA0 Qlu8jy5lNw+e7DD/cucNt8PuzEJ0m4dwIaoChs18r8WFU+1/9C6BAq0n3LirfDk4yrbucQxS8O6 /xK84qWmCVl7WrwmSHM8a/WNgT5SqSfKlNo3uanvlyUx8oY2VRz76apoVkIkIsj1wBYW/B9mQJg 9NbSslI4ohdhjP1l6yXiQSOKN4GC+w== X-Google-Smtp-Source: AGHT+IGiIKJIihXmyHTChh917c1Js0pVeG9Vf7NWwWydHbDw8oXp8Wa42Js7HH3AC2SINkgrEZoLzQ== X-Received: by 2002:a05:6402:2806:b0:5d0:c7a7:ac13 with SMTP id 4fb4d7f45d1cf-5d3be744ef2mr28005883a12.34.1733685462163; Sun, 08 Dec 2024 11:17:42 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, philmd@linaro.org, thuth@redhat.com, zhao1.liu@intel.com, imammedo@redhat.com, akihiko.odaki@daynix.com, Phil Dennis-Jordan Subject: [PATCH 3/6] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported. Date: Sun, 8 Dec 2024 20:16:43 +0100 Message-Id: <20241208191646.64857-4-phil@philjordan.eu> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241208191646.64857-1-phil@philjordan.eu> References: <20241208191646.64857-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::62a; envelope-from=phil@philjordan.eu; helo=mail-ej1-x62a.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1733685533556116600 Content-Type: text/plain; charset="utf-8" The XHCI specification, section 4.17.1 specifies that "If Interrupter Mapping is not supported, the Interrupter Target field shall be ignored by the xHC and all Events targeted at Interrupter 0." QEMU's XHCI device has so far not specially addressed this case, so we add a check to xhci_event() to redirect to event ring and interrupt 0 if mapping is disabled. Signed-off-by: Phil Dennis-Jordan --- hw/usb/hcd-xhci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index d85adaca0dc..5fb140c2382 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -644,6 +644,10 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *eve= nt, int v) dma_addr_t erdp; unsigned int dp_idx; =20 + if (xhci->numintrs =3D=3D 1) { + v =3D 0; + } + if (v >=3D xhci->numintrs) { DPRINTF("intr nr out of range (%d >=3D %d)\n", v, xhci->numintrs); return; --=20 2.39.5 (Apple Git-154) From nobody Wed Jan 8 03:16:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733685567826352.1716620819876; Sun, 8 Dec 2024 11:19:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKMmx-0005Ll-8a; Sun, 08 Dec 2024 14:17:55 -0500 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 1tKMmo-0005JQ-FW for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:49 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKMmm-0001WI-Fq for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:46 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a9e8522445dso722017866b.1 for ; Sun, 08 Dec 2024 11:17:44 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa665119a06sm240350866b.121.2024.12.08.11.17.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 08 Dec 2024 11:17:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1733685463; x=1734290263; 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=j11kvPWanlGrLLqG7zb7nxcA1SYE5rW2xVpp2lF0V4o=; b=FcIiuXUEHOTMTxLDOzsUN0bhFxePW6aQxKVhffI8jCSThVLM1zIbmetxy1Eqe9+fxK qUK0cUkJ+Y/DNW/nDyMTCH3mD60Om9Q2Am7iBTxi479DSj9RWzwiDVN+65J5t7FrtXsp KUCMEhzJGMz4SmlVxtoDDEZBEP3NSTQKdGOMQq4v04aQtazKMmv+xQBoJWR8ShpopCeN 9wYQfbf78VrFvLHejowMxVuCg8aKAtHrbsYWo2826PaoKb9bHWYEiFq/Tvk1pNRVd3Jk uI08bzBLIH/0LCSj3L2pXbY+8gozwoPd8Z5kX5cUW98O70xYkT1es6Voz/j3reeDBdS2 ZOrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733685463; x=1734290263; 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=j11kvPWanlGrLLqG7zb7nxcA1SYE5rW2xVpp2lF0V4o=; b=wdvHd853oK+B6IRLnAULdxiUBrSnm2QApTHlKIZKbSvS6SEIFiiA2GbZU9cMus4uTg cJcdICI/j/XKKXfpQGSxIgYh0uxpelb7aAoiUhK8zz2IFiCShy/fpYCM9OmPzn0pwNTj B79SObexv8oYIJcJt3aXDjt+eEfbAbDcCXECRDQBt+Dit2T9cKEK0SslPhhQeUB3cpM/ XNwxwnlzFsS+b7BtGdb2mfufn2HqZxQhUMo6qVl4sw0fcDlg7h9R8/sFsEGnY+n3nJtJ VopAYXtwtFzmiejjotQHlZ5IWUytHuRhJSMuQQBIpbhcpVDJbTBWvfFMNaJCenbcmAVA z53A== X-Gm-Message-State: AOJu0Yw4XzOlbxALQUC+08a8LOuUc7oIwZRYh0Q2gs+scjbkicwdQJMQ p8qXFSbzpSKhmpLSTuEFFOBqbnjguTk0HAO4TIdiczOyYnykB2aFKcrFal8G5oMvVr2uyzgu57H O5w== X-Gm-Gg: ASbGncvlofNExijIeG9mMg1RkpMMFmb/RhllhfQ4/0tVHCq0QBCTCd7WMsmSqXFT1Jo x3JieFW2QGIjtLDaySvv7fns3+MyuanUc45FjSRfoDpSQXT2cy/YCT10DkWA/ToANt8e9SQq8v5 mstJF3sRRDcWIdZweTBWA89eBCxXYipay+1m5awcePMULTo+DVDWx7TaRs6kJ1wU2Lr9Tc/+Aq3 Wp29Pc8A3t+vPRkJxPKhFQUQuyacE/8RiGW+KMOhTMskiwGYU52hhcN7by+AtdVtl7ZVoI0jdT8 ZFZklVxsWBKjxqcKbp7jlv/UBA== X-Google-Smtp-Source: AGHT+IEyqrOvp78VZ1deiWl5GzaALRWisEoRUKmGh3s4KwBeulVCEM/CbvGW+ls5n2n9wyPGgdYOwQ== X-Received: by 2002:a17:907:1de6:b0:aa6:59ef:ec with SMTP id a640c23a62f3a-aa659ef01a8mr445374866b.1.1733685463114; Sun, 08 Dec 2024 11:17:43 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, philmd@linaro.org, thuth@redhat.com, zhao1.liu@intel.com, imammedo@redhat.com, akihiko.odaki@daynix.com, Phil Dennis-Jordan Subject: [PATCH 4/6] hw/usb/hcd-xhci-pci: Adds property for disabling mapping in IRQ mode Date: Sun, 8 Dec 2024 20:16:44 +0100 Message-Id: <20241208191646.64857-5-phil@philjordan.eu> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241208191646.64857-1-phil@philjordan.eu> References: <20241208191646.64857-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::62c; envelope-from=phil@philjordan.eu; helo=mail-ej1-x62c.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1733685581953116600 Content-Type: text/plain; charset="utf-8" This change addresses an edge case that trips up macOS guest drivers for PCI based XHCI controllers. The guest driver would attempt to schedule events to XHCI event rings 1 and 2 even when only one interrupt line is available; interrupts would therefore be dropped, and events only handled on timeout when using pin-based interrupts. Moreover, when MSI is available, the macOS guest drivers would only configure 1 vector and leading to the same problem. So, in addition to disabling interrupter mapping if numintrs is 1, a callback is added to xhci to check whether interrupter mapping should be enabled. The PCI XHCI device type now provides an implementation of this callback if the new "conditional-intr-mapping" property is enabled. (default: disabled) When enabled, interrupter mapping is only enabled when MSI-X is active, or when MSI is active with more than 1 vector. This means that when using pin-based interrupts, or only 1 MSI vector, events are only submitted to interrupter 0 regardless of selected target. This allows the macOS guest drivers to work with the device in those configurations. Signed-off-by: Phil Dennis-Jordan Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2705 --- hw/usb/hcd-xhci-pci.c | 23 +++++++++++++++++++++++ hw/usb/hcd-xhci-pci.h | 1 + hw/usb/hcd-xhci.c | 3 ++- hw/usb/hcd-xhci.h | 5 +++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c index 0278b0fbce2..8e293cd5951 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -81,6 +81,23 @@ static bool xhci_pci_intr_raise(XHCIState *xhci, int n, = bool level) return false; } =20 +static bool xhci_pci_intr_mapping_conditional(XHCIState *xhci) +{ + XHCIPciState *s =3D container_of(xhci, XHCIPciState, xhci); + PCIDevice *pci_dev =3D PCI_DEVICE(s); + + /* + * Implementation of the "conditional-intr-mapping" property, which on= ly + * enables interrupter mapping if there are actually multiple interrupt + * vectors available. Forces all events onto interrupter/event ring 0 + * in pin-based IRQ mode or when only 1 MSI vector is allocated. + * Provides compatibility with macOS guests on machine types where MSI= -X is + * not available. + */ + return msix_enabled(pci_dev) || + (msi_enabled(pci_dev) && msi_nr_vectors_allocated(pci_dev) > 1); +} + static void xhci_pci_reset(DeviceState *dev) { XHCIPciState *s =3D XHCI_PCI(dev); @@ -118,6 +135,9 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev,= Error **errp) object_property_set_link(OBJECT(&s->xhci), "host", OBJECT(s), NULL); s->xhci.intr_update =3D xhci_pci_intr_update; s->xhci.intr_raise =3D xhci_pci_intr_raise; + if (s->conditional_intr_mapping) { + s->xhci.intr_mapping_supported =3D xhci_pci_intr_mapping_condition= al; + } if (!qdev_realize(DEVICE(&s->xhci), NULL, errp)) { return; } @@ -200,6 +220,9 @@ static void xhci_instance_init(Object *obj) static Property xhci_pci_properties[] =3D { DEFINE_PROP_ON_OFF_AUTO("msi", XHCIPciState, msi, ON_OFF_AUTO_AUTO), DEFINE_PROP_ON_OFF_AUTO("msix", XHCIPciState, msix, ON_OFF_AUTO_AUTO), + /* When true, disable interrupter mapping for IRQ mode or only 1 vecto= r */ + DEFINE_PROP_BOOL("conditional-intr-mapping", XHCIPciState, + conditional_intr_mapping, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h index 08f70ce97cc..5b61ae84555 100644 --- a/hw/usb/hcd-xhci-pci.h +++ b/hw/usb/hcd-xhci-pci.h @@ -40,6 +40,7 @@ typedef struct XHCIPciState { XHCIState xhci; OnOffAuto msi; OnOffAuto msix; + bool conditional_intr_mapping; } XHCIPciState; =20 #endif diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5fb140c2382..b607ddd1a93 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -644,7 +644,8 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *even= t, int v) dma_addr_t erdp; unsigned int dp_idx; =20 - if (xhci->numintrs =3D=3D 1) { + if (xhci->numintrs =3D=3D 1 || + (xhci->intr_mapping_supported && !xhci->intr_mapping_supported(xhc= i))) { v =3D 0; } =20 diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h index fe16d7ad055..fdaa21ba7f6 100644 --- a/hw/usb/hcd-xhci.h +++ b/hw/usb/hcd-xhci.h @@ -193,6 +193,11 @@ typedef struct XHCIState { uint32_t max_pstreams_mask; void (*intr_update)(XHCIState *s, int n, bool enable); bool (*intr_raise)(XHCIState *s, int n, bool level); + /* + * Callback for special-casing interrupter mapping support. NULL for m= ost + * implementations, for defaulting to enabled mapping unless numintrs = =3D=3D 1. + */ + bool (*intr_mapping_supported)(XHCIState *s); DeviceState *hostOpaque; =20 /* Operational Registers */ --=20 2.39.5 (Apple Git-154) From nobody Wed Jan 8 03:16:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1733685552; cv=none; d=zohomail.com; s=zohoarc; b=RMaUBizU4I15K6aaADtgaWK3RaQbmEZkxOJAKblE6ZWU3pq+VuzrYqRTfS0YcDHRgm2zsKGHeDmysCfWGXI/Q46/lrz9jaoL9v748QS+cTRdYd4fj/rKk6W6ycq0sCxdYiacdobqYKVrOJjzC79+fzn0hCxyT73FlckEl1K/agA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733685552; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lSrK0KIvSps8khYl73b0xinOM0CEMUR/qWbB2TAKeag=; b=XoKetncdqzmTWLY+Nh06ZRtaeYA8foiWCXcLLII0juT/gYsB/fDaeoKjJQQFhorzNUoyNqS35DM9rZmz9wL4Y9qVVfl4WsTHpy4ZmTJVZQl1YICMI/kjnMYMGGN/tHXN3rIJEDjJLbruZhl8EtCphLJLA9AcBxrhNWbSmq9/Osg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733685551958796.5792704457143; Sun, 8 Dec 2024 11:19:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKMmv-0005L0-3N; Sun, 08 Dec 2024 14:17:53 -0500 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 1tKMmq-0005Ja-BS for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:49 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKMmo-0001Wi-W7 for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:48 -0500 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-aa684b6d9c7so59281366b.2 for ; Sun, 08 Dec 2024 11:17:46 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa665119a06sm240350866b.121.2024.12.08.11.17.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 08 Dec 2024 11:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1733685465; x=1734290265; 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=lSrK0KIvSps8khYl73b0xinOM0CEMUR/qWbB2TAKeag=; b=j8IkPTSK4oeUaZdwZPSXD2dc/Va9Csmc2BwgEE6ZdpgnO0ZJ273wUZ0E7u7LcR+p02 RWaNLoNtCR/j+y9yIXYdgylobDj9QivkBC7xz/D10UQ431A7sfU8/HpNDVluWrp6Tn5H YHeMJ+bAn0yt8K7OK+PwsjO0G0DWb9mDiyCncsET2Hlkrt6leOzhmy/hcxJ06b/j2LeP 6Pkyx1JkAeXRCFDZ/l116JHC+iVrWS0sEh2Sh24tdJ9EK9czY8fNn6K7oRu0jjRM2yFW v9bBKQUtKNuH8bDAERwdgcri8ru0KnlGcA4jRnsKWm8T1Qe0h7cde+eGAWfPpkWoAEzO rBiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733685465; x=1734290265; 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=lSrK0KIvSps8khYl73b0xinOM0CEMUR/qWbB2TAKeag=; b=DrvS37IhgUAR0+XgssOpFAMqLMl05Zyc5O1YzeEjpr8xPDzPnBVvGu+UsBZXEzt5OE DDyW5W6rcuiS+C5632ftOx3UNMlB3hD0LIg5OMnU6Wo5TRJS66CV8+7+fNtH6ukPEU/J dzY4HnCTQXndo/Pjb6vOWXmHEqLhWzSZH/CmJ19p74ADtpwM2e7JrZZ1ZkPb3QrXWsqu k8hbpP4T3dyC3Uwk0ddzpS1nP2pkhMm6WEiWzZjTZ+xK2nMYsPUM5k7iYM4SHFBGuTOg iaonoSYVjZG3f/vqRGhZpTv9bwYGQlptjsQGb2KYChpw+5ot/ubejCy563rRThfC/KTi 2DXw== X-Gm-Message-State: AOJu0YysmZBTO8UQz1qjjfkvc1iMby1ytWZfePlN9vnco+Y/c4CjFqo+ qg6FP5Z33AiFxf8ZMO7w4ggdWSYf9qK7HztSQk+iEKM/UksgL8qio2KdUm3bR64Hy5BPNlnnpIG NIg== X-Gm-Gg: ASbGncuLGbJBgwGfEf2UuL8REgXVVOlq0AOyCVk/kl97Tr6Pch8hr/R5hh8kZ6/Z5Xd Isbn5edPXgVs6Wcxcjp7jrUJrAsTRkFqPt9l2igIMwoj//3QujS3xegZYjOp9NN4JJrTSYL6TJp y8eQI/QckiX5I/B6vao0MjBbCqFe1b1Cz4XC6qQyHm/Iu2M1f0/XAlaGMg2Zzth9P5Yn5/bmm8S 6FgxEHKYKMEN+puo2wUtkStrJ+B1SLYTcpUhu+Z/jInpuaLmw5Gn5b5zdXXkzCWP0r5lvCsitLh 4C/PYyDwUTcSX+hkBBpZyX/nIg== X-Google-Smtp-Source: AGHT+IGAN4bwicfgo5P/qLjcbPQsTrM9+khvMX+246bA852bdueXIVjZqOpGMIbPBw0atBJlOLn7pQ== X-Received: by 2002:a17:906:30c7:b0:aa6:5201:7ae3 with SMTP id a640c23a62f3a-aa652017fddmr561191166b.40.1733685465004; Sun, 08 Dec 2024 11:17:45 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, philmd@linaro.org, thuth@redhat.com, zhao1.liu@intel.com, imammedo@redhat.com, akihiko.odaki@daynix.com, Phil Dennis-Jordan Subject: [PATCH 5/6] hw/usb/hcd-xhci-pci: Indentation fix Date: Sun, 8 Dec 2024 20:16:45 +0100 Message-Id: <20241208191646.64857-6-phil@philjordan.eu> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241208191646.64857-1-phil@philjordan.eu> References: <20241208191646.64857-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::635; envelope-from=phil@philjordan.eu; helo=mail-ej1-x635.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1733685553674116600 Content-Type: text/plain; charset="utf-8" Fixes number of spaces used for indentation on one line. Signed-off-by: Phil Dennis-Jordan --- hw/usb/hcd-xhci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c index 8e293cd5951..6b6f0f91a18 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -111,7 +111,7 @@ static int xhci_pci_vmstate_post_load(void *opaque, int= version_id) PCIDevice *pci_dev =3D PCI_DEVICE(s); int intr; =20 - for (intr =3D 0; intr < s->xhci.numintrs; intr++) { + for (intr =3D 0; intr < s->xhci.numintrs; intr++) { if (s->xhci.intr[intr].msix_used) { msix_vector_use(pci_dev, intr); } else { --=20 2.39.5 (Apple Git-154) From nobody Wed Jan 8 03:16:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1733685552; cv=none; d=zohomail.com; s=zohoarc; b=ZEfvXQSIw7mMZcH4zBITQdZMjhx351+eVYG2Ruvv2JgL+ljS4cNNtAjgwG9Rlh9fcCKyKGW6CQn0jYdC35fntIzpwjRxhvE0YWCyWquDJHFbfi6VpiQP3txFXqsJ1JfiErQo8hcsladcA2ip2dRH/hmy4snKLx7xxwy1LlesNqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733685552; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=F/FQnyaymDlHcJ5QODQTDwIMUzbyGNUlK4WHRRDGI7E=; b=FwTcsXyFOo3K6Ioh1ALNxCtzeR5Sqn11psUX6ZtTBlE3IBIhx/86/ltWCtPddnQ+e18MO+8QWMnnCCjELECTfztapkMpglGsDtiz3l06b4k4Iq758v7YPiVvsXQDF0RdOI3YYv7Y41TbhGw4Ph8Z/m4g5OBGtYgLRQjFEQICzpw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733685552199687.3148153948264; Sun, 8 Dec 2024 11:19:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKMmy-0005M5-42; Sun, 08 Dec 2024 14:17:56 -0500 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 1tKMms-0005KG-9X for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:51 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKMmq-0001Ww-Nq for qemu-devel@nongnu.org; Sun, 08 Dec 2024 14:17:50 -0500 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aa67333f7d2so96984466b.0 for ; Sun, 08 Dec 2024 11:17:48 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa665119a06sm240350866b.121.2024.12.08.11.17.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 08 Dec 2024 11:17:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1733685467; x=1734290267; 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=F/FQnyaymDlHcJ5QODQTDwIMUzbyGNUlK4WHRRDGI7E=; b=UZ+9Tlab5I1mw23dsjqGnHy18GBoPBdznf7kgPTSmP71LD+HlMfTJE1Qibe5YNBvhg sJNwoARlzF73iz0/qpVdylWQJQAlSJA29KJvLsFCT42FuCqV0+1l5dzvZr/2HWuU2Arc HLVwtkIdYls7afZDFPiNp+NzboqHVhnQCqZ65cRTQW6bgcuUb9as6DCldJWfgIwnqZQR UIGX06gFCs8SIKIDcC1267yr0bDts9gxcpEksUPdyoeuCoi/T8zm68z1ZLFuNWFJ2qEd 92ZnRw/b0J8jkPHHP5Lv882AN+6Nv8Pdxxm3JHHxmQUXvN5Cpl/0vPxrBw3x8N5lGDHP OPkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733685467; x=1734290267; 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=F/FQnyaymDlHcJ5QODQTDwIMUzbyGNUlK4WHRRDGI7E=; b=ThBgTChRtZwSXSn+5b3lDXU0iC+ADsGQupLk7/FXo/cjnAED+GGuaaEbRNTx3mC9/H mLVQyfVe87HzbgBPbIf6W4hOkTMPKXWEg6oFv7kQ/6qzi7y/51qDchmWZs5X58afQZY9 556MLziTAgrk76xqfsqqkbNlv4SKVS99+50B3GWG8qTaUPOu38dgU/Ed2CB4eACge8DV Yj6NSNQ97Bk9Sl/nnPPTseCXdq/5ESIDV4L4lgNuIjWEOFnb2NXKoAjAsI7yO87ePpLr Y65DIr1LC5vl8HmWsNqVxJI+i+qwbSGrL+3FXyzTCFseQB4N3G+VPV+9LfKFxPVnHm6i GJSg== X-Gm-Message-State: AOJu0YygCio0rYBv2IX2wTNicoUSjWGQCypphbzXHA0OkRKcOtZghEEb z1IU7PiL5SEjbXNCwmUpkxplUDEvjk3r0heP/QMLC86SOfWmgPwka28c32bzmGIzpnBSPs8iN/H 4tw== X-Gm-Gg: ASbGncsE1X0dwfIsbPOXYXPHtoDI4DO/ez65+poWyHqXmt20vL3N/qgJF6DxfF2gEnA 8tIb/Cgni77vhDCZKJoGJ83KUhCfpvPffj95UWzkSJsO9pgRHAYdrkVfTz8DLOvP8HpxT/+h3w8 xrse9SSm5mTnC0ZjU9YrdIkz6f3cbrMu/E3yyCQj5SH6mllLiVKkwif1RjfMX058t7E7oN+wQOA nO+CGfF7UeqVpL/Vs7x/mUM54AoLWohHFLycPm6h1CF5hPy7EOLSLLoABooLlqApRbGkZVBrFZI Qi9b6Sic9UZiRJdQrZU6w/X/hg== X-Google-Smtp-Source: AGHT+IGVCrf9khaUMdx10i5J4p7xh4y+2m02UBNgTwdh5t4J+5DWBadO8NuGIM0KML0+GEkPmVKqTA== X-Received: by 2002:a17:907:cc26:b0:aa6:8676:3b3b with SMTP id a640c23a62f3a-aa686763cefmr121703466b.30.1733685465892; Sun, 08 Dec 2024 11:17:45 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, philmd@linaro.org, thuth@redhat.com, zhao1.liu@intel.com, imammedo@redhat.com, akihiko.odaki@daynix.com, Phil Dennis-Jordan Subject: [PATCH 6/6] hw/vmapple: XHCI controller's interrupt mapping workaround for macOS Date: Sun, 8 Dec 2024 20:16:46 +0100 Message-Id: <20241208191646.64857-7-phil@philjordan.eu> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241208191646.64857-1-phil@philjordan.eu> References: <20241208191646.64857-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::62f; envelope-from=phil@philjordan.eu; helo=mail-ej1-x62f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1733685553662116600 Content-Type: text/plain; charset="utf-8" This change enables the new conditional interrupt mapping support property on the vmapple machine type's integrated XHCI controller. The macOS guest driver attempts to use event rings 1 and 2 on the XHCI controller, despite there being only one (PCI pin) interrupt channel available. With conditional interrupt mapping enabled, the XHCI controller will only schedule events on interrupter 0 in PCI pin mode or when only a single MSI vector is active. Signed-off-by: Phil Dennis-Jordan --- hw/vmapple/vmapple.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/vmapple/vmapple.c b/hw/vmapple/vmapple.c index f607981bc40..156ea33ae79 100644 --- a/hw/vmapple/vmapple.c +++ b/hw/vmapple/vmapple.c @@ -453,6 +453,13 @@ static void create_pcie(VMAppleMachineState *vms) } =20 usb_controller =3D qdev_new(TYPE_QEMU_XHCI); + /* + * macOS XHCI driver attempts to schedule events onto even rings 1 & 2 + * even when (as here) there is no MSI-X support on this PCIe bus. Dis= abling + * interrupter mapping in the XHCI controller works around the problem. + */ + object_property_set_bool(OBJECT(usb_controller), + "conditional-intr-mapping", true, &error_fata= l); qdev_realize_and_unref(usb_controller, BUS(pci->bus), &error_fatal); =20 usb_bus =3D USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS, --=20 2.39.5 (Apple Git-154)