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.web08.6372.1654175705695218646 for ; Thu, 02 Jun 2022 06:15:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KUTqxCcG; 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=1654175704; 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: in-reply-to:in-reply-to:references:references; bh=7LI/tvXR3ZhJ3on/cTstWzuM3m/bBoZQzsxvQHMVqlQ=; b=KUTqxCcGbjCOjVQzlr2vhZxh23ZX3KujmFoNkrD/C/BT/6aSDFU6rqZSAHL7sZByGWsXci lMSXgGWPMyBBa5QX1wpflRNwRPA3/p4+5JN3515GH7nM/T9svHOjKJtKQhMAsTsnj9LEl8 0c2VDPh8+RMB+yodAfUJENbin8AkGe4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-6QU9WBjYM8WzZjNuuh-1vQ-1; Thu, 02 Jun 2022 09:15:01 -0400 X-MC-Unique: 6QU9WBjYM8WzZjNuuh-1vQ-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 79223811E76; Thu, 2 Jun 2022 13:14:59 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C998492C3B; Thu, 2 Jun 2022 13:14:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C497A1800397; Thu, 2 Jun 2022 15:14:57 +0200 (CEST) Date: Thu, 2 Jun 2022 15:14:57 +0200 From: "Gerd Hoffmann" To: Ard Biesheuvel Cc: "Ni, Ray" , "devel@edk2.groups.io" , "Wu, Hao A" , Pawel Polawski , Ard Biesheuvel , "Albecki, Mateusz" , "Chang, Abner" , Leif Lindholm , "Yao, Jiewen" , Oliver Steffen , "Gao, Liming" , "Wang, Jian J" , "Justen, Jordan L" Subject: Re: [PATCH v7 1/6] MdeModulePkg/PciHostBridge: io range is not mandatory Message-ID: <20220602131457.75zndaiipdosgiid@sirius.home.kraxel.org> References: <20220602084216.159028-1-kraxel@redhat.com> <20220602084216.159028-2-kraxel@redhat.com> MIME-Version: 1.0 In-Reply-To: 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=us-ascii Content-Disposition: inline Hi, > I did a quick test with both ArmVirtQemu and microvm (using this > series but omitting the MdeModulePkg), and I can confirm that not > having a I/O resource window at all seems to work fine if none of the > PCI devices have I/O BARs. > > Gerd, do you remember why exactly this patch is needed? Is it related > to devices that have I/O BARs but don't actually require them to > function correctly? Well, the difference seem to be pcie root ports. When plugging my virtio device into the root bus everything is fine: PCI Bus First Scanning PciBus: Discovered PCI @ [00|00|00] PciBus: Discovered PCI @ [00|01|00] BAR[1]: Type = Mem32; Alignment = 0xFFF; Length = 0x1000; Offset = 0x14 BAR[4]: Type = PMem64; Alignment = 0x3FFF; Length = 0x4000; Offset = 0x20 [ ... ] PciHostBridge: NotifyPhase (AllocateResources) RootBridge: PciRoot(0x0) Mem64: Base/Length/Alignment = 6000000000/100000/FFFFF - Success Mem: Base/Length/Alignment = C0000000/100000/FFFFF - Success PciBus: HostBridge->NotifyPhase(AllocateResources) - Success When plugging the virtio device into a pcie root port it doesn't work and the log looks like this: PCI Bus First Scanning PciBus: Discovered PCI @ [00|00|00] PciBus: Discovered PPB @ [00|08|00] Padding: Type = Mem32; Alignment = 0x1FFFFF; Length = 0x200000 Padding: Type = Io; Alignment = 0x1FF; Length = 0x200 BAR[0]: Type = Mem32; Alignment = 0xFFF; Length = 0x1000; Offset = 0x10 PciBus: Discovered PCI @ [01|00|00] BAR[1]: Type = Mem32; Alignment = 0xFFF; Length = 0x1000; Offset = 0x14 BAR[4]: Type = PMem64; Alignment = 0x3FFF; Length = 0x4000; Offset = 0x20 [ ... ] PciHostBridge: NotifyPhase (AllocateResources) RootBridge: PciRoot(0x0) Mem: Base/Length/Alignment = C0000000/300000/1FFFFF - Success Mem64: Base/Length/Alignment = 6000000000/100000/FFFFF - Success I/O: Base/Length/Alignment = FFFFFFFFFFFFFFFF/1000/FFF - Out Of Resource! [ ... ] PciHostBridge: NotifyPhase (AllocateResources) RootBridge: PciRoot(0x0) Mem64: Base/Length/Alignment = 6000000000/100000/FFFFF - Success Mem: Base/Length/Alignment = C0000000/200000/FFFFF - Success I/O: Base/Length/Alignment = FFFFFFFFFFFFFFFF/0/FFF - Out Of Resource! So, it's apparently the io window of the pcie root port which causes edk2 try allocate io resources. take care, Gerd