From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.4802.1687776180808401178 for ; Mon, 26 Jun 2023 03:43:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IlZP7+nK; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 46CD960DC1 for ; Mon, 26 Jun 2023 10:43:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE2F0C433C9 for ; Mon, 26 Jun 2023 10:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687776179; bh=kIH+LPXJeoOCq8wn6cVMj2TcMzzYhuXIn2K3PAzzO+c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IlZP7+nKRSj2TQ6+t0BZ1bGiAJ8k1a6H8IHkaHyf6EhPL4+9S6ewM4fBOV2lfwQNv ldyyXRkAzEk5DdgG7DQKreSgR2EAziYj1ZMAL9z6arPu5GH7ZigaGVExponkh+dPOx XbFXAItU5IZXc8cV8Pg0SRZXqlRYitFXG5cOPl6RAEDoQ01KX/dB6lAhJpptSbeHSQ aTBFSvttEKzJBatp9emRtWm2nvtZkVLu3tqnIw6DrrFz4QenLtI58AMAUeC70hQZAm 7ibHYxNFcE5nyqnm9MoqNcSNkKonkJy+dhkTUlZv1UzJVAETUdVw0yqgVExtNJ2M/6 ShzDvjDPjnbog== Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-4f867700f36so4069048e87.0 for ; Mon, 26 Jun 2023 03:42:59 -0700 (PDT) X-Gm-Message-State: AC+VfDwoMy4viOX1/Xx5+iWXzStUx4nmGJ6gXNGuVi/YoRXBgXMI1Ncl Hvq8QTBa4Klc6JBWbWDKS3MAYjb+5Es2v977rCo= X-Google-Smtp-Source: ACHHUZ4eprGs4sy6wlQuuyB6+o+Hudle0yW/qOxM2H+h8V2mMo9ufutjqIX3EeUSXgnkdzqh+9hsgENbEV40CoBk8O8= X-Received: by 2002:a05:6512:3f19:b0:4fa:6d62:9219 with SMTP id y25-20020a0565123f1900b004fa6d629219mr2342685lfa.62.1687776157438; Mon, 26 Jun 2023 03:42:37 -0700 (PDT) MIME-Version: 1.0 References: <20230626103819.293209-1-kraxel@redhat.com> In-Reply-To: <20230626103819.293209-1-kraxel@redhat.com> From: "Ard Biesheuvel" Date: Mon, 26 Jun 2023 12:42:25 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/1] OvmfPkg/PciHotPlugInitDxe: fix io window size To: Gerd Hoffmann Cc: devel@edk2.groups.io, Jordan Justen , Oliver Steffen , Ard Biesheuvel , Jiewen Yao Content-Type: text/plain; charset="UTF-8" On Mon, 26 Jun 2023 at 12:38, Gerd Hoffmann wrote: > > Smallest IO window size for PCI bridges is 0x1000. Fix default size > accordingly. Avoids broken resource assignments like this: > > [ ... ] > PciBus: Resource Map for Root Bridge PciRoot(0x0) > Type = Io16; Base = 0x6000; Length = 0x7000; Alignment = 0xFFF > [ ... ] > Base = 0xC000; Length = 0x200; Alignment = 0xFFF; Owner = PPB [00|02|00:**] > Base = 0xC200; Length = 0x40; Alignment = 0x3F; Owner = PCI [00|1F|03:20] > Base = 0xC240; Length = 0x20; Alignment = 0x1F; Owner = PCI [00|1F|02:20] > [ ... ] > > ... which the linux kernel fixes up later: > > [ 0.644657] pci 0000:00:1f.3: BAR 4: assigned [io 0x1000-0x103f] > [ 0.646833] pci 0000:00:1f.2: BAR 4: assigned [io 0x1040-0x105f] > > With the patch applied: > > { ... ] > PciBus: Resource Map for Root Bridge PciRoot(0x0) > Type = Io16; Base = 0x6000; Length = 0x8000; Alignment = 0xFFF > [ ... ] > Base = 0xC000; Length = 0x1000; Alignment = 0xFFF; Owner = PPB [00|02|00:**] > Base = 0xD000; Length = 0x40; Alignment = 0x3F; Owner = PCI [00|1F|03:20] > Base = 0xD040; Length = 0x20; Alignment = 0x1F; Owner = PCI [00|1F|02:20] > [ ... ] > > Signed-off-by: Gerd Hoffmann Thanks - I've queued this up now. > --- > OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c > index 69903a600981..bb2389d16c70 100644 > --- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c > +++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c > @@ -741,7 +741,7 @@ GetResourcePadding ( > // > // Request defaults. > // > - SetIoPadding (--FirstResource, (UINTN)HighBitSetRoundUp64 (512)); > + SetIoPadding (--FirstResource, (UINTN)HighBitSetRoundUp64 (0x1000)); > } > > if (DefaultMmio) { > -- > 2.41.0 >