From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web09.51423.1654013512908042988 for ; Tue, 31 May 2022 09:11:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LB84vsti; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654013511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CQ29Q9A2CUBI8oT/9qz199RVJQ6t1QzKl8qRjmxUX8Q=; b=LB84vsti+Py3Y4qOnL+mf7ARghIVgYPgvSXZj0RmGeHmKeuhfLUH3XwJhiMnuktqgsUZ51 Hc0X+uMma1kkC+rh0Ne417Si6wgv5J6dVbfeBe97E0DqP7bozY/1Xm83P/yycSgSBBGcDO xPOxdYOTlDQ8gIeiZGvXFiWHewjUJ7s= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-olBbGPM7MDiVSBbdT5_NSQ-1; Tue, 31 May 2022 12:11:48 -0400 X-MC-Unique: olBbGPM7MDiVSBbdT5_NSQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4306E3C0F746; Tue, 31 May 2022 16:11:43 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1007F492C3B; Tue, 31 May 2022 16:11:43 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 80064180039C; Tue, 31 May 2022 18:11:36 +0200 (CEST) Date: Tue, 31 May 2022 18:11:36 +0200 From: "Gerd Hoffmann" To: "Albecki, Mateusz" Cc: devel@edk2.groups.io Subject: Re: [edk2-devel] [PATCH v5 1/6] MdeModulePkg/PciHostBridge: io range is not mandatory Message-ID: <20220531161136.iojk6glelb2xtud7@sirius.home.kraxel.org> References: <20220524062446.x4gpibum74zwi4zu@sirius.home.kraxel.org> <4256.1653503206815963836@groups.io> MIME-Version: 1.0 In-Reply-To: <4256.1653503206815963836@groups.io> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi, > To make things worse I see that if we return success there EDK2 will > actually go ahead and start assigning trash addresses to the device > and enable IO space decoding in case of the PCI root port which means > that device will try to decode invalid IO ranges. > Logs: > PciBus: Resource Map for Root Bridge PciRoot(0x0) > Type =   Io16; Base = 0xFFFFFFFFFFFFFFFF; Length = 0x1000; Alignment = 0xFFF That is wrong indeed. I think *this* should work ... + } else if ((Index == TypeIo) && + (RootBridge->Io.Base == MAX_UINT64) && + (RootBridge->ResAllocNode[Index].Length == 0)) { + /* I/O is optional on PCIe */ + DEBUG ((DEBUG_INFO, "Success (PCIe NoIO)\n")); ... i.e. return success only in case there are no allocation requests for IO ranges. > > Also note that for pcie root bridges which do support io address space > > this patch changes nothing. > > It seems to me like it does. It doesn't. When io address space is present the "RootBridge->Io.Base == MAX_UINT64" check will never be true. But the "no io address space" case was wrong indeed. > I think to really handle it we would have to have a more involved > change. If we want support PCIe devices with I/O bars behind a PCIe host bridge without I/O window, then yes. My main focus is supporting PCIe devices without I/O bars though. This doesn't work currently because the code considers a pcie host bridge without I/O window a hard failure even in case there are no I/O allocation requests. For fixing that the five lines above should be enough I think. thanks & take care, Gerd