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.9481.1645704610655071049 for ; Thu, 24 Feb 2022 04:10:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dH572qu7; 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 797A9618D8 for ; Thu, 24 Feb 2022 12:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E41B2C340F4 for ; Thu, 24 Feb 2022 12:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645704608; bh=dz8CMjVCtmI0ysyov4oN8XjfXrcWHnP1n8BxkQ5WRAc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dH572qu7Vc98E4HNde8G7H0N3KCVGt702g/yR1sDIeyjDW2AdGDzgb5MquCNdRDWl L5CixiqgdE4RqEg4/mXPoxBsKikxZFP6cVQ6H8IAxXE0B6fghEx8qWZ+Kj7FRVPAEX 63NteEeEfzhZuZ7xQJYd4aA0+8Z+9GR9RcmEtM0y2ygFCGyzmShIJ8g7DB78a95qsN Tf4LKoypsoewRYvGwyzD7NEHjcJ5uRZ0B3MBpWOwg0F6Y615icvs/hWHkw/5AaZXSk zznmexV1TlyzSyQWx9W21PZppofGCacmzx6cCV+OCORcramFuKHt52/JM3uG3gS6WX T0JW0ve3PCg2g== Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-2d625082ae2so22774867b3.1 for ; Thu, 24 Feb 2022 04:10:08 -0800 (PST) X-Gm-Message-State: AOAM531DthJ++LNgK3RIJdvw50f01UXnRrkK46h8cHDNqKcXO7q8ru5w UsLaowum1et9yTjkxBfgF4CnGjrTgUpNuuaNsKw= X-Google-Smtp-Source: ABdhPJzsKrY2kuTgGZ3vB3D23LGwvNWLtwrFTJ3kbveLDoQzAKNYlnfdupXjnCfdB3ChJCj3m+mj7CH3Owe9BUOFV0U= X-Received: by 2002:a0d:dfd5:0:b0:2cf:924b:105d with SMTP id i204-20020a0ddfd5000000b002cf924b105dmr2087218ywe.342.1645704607994; Thu, 24 Feb 2022 04:10:07 -0800 (PST) MIME-Version: 1.0 References: <20220224114744.1966974-1-quic_tpilar@quicinc.com> In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 24 Feb 2022 13:09:56 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] MdeModulePkg: Correct high-memory use in NvmExpressDxe To: Tomas Pilar Cc: edk2-devel-groups-io , Ray Ni , Ard Biesheuvel , Leif Lindholm Content-Type: text/plain; charset="UTF-8" On Thu, 24 Feb 2022 at 12:58, Ard Biesheuvel wrote: > > On Thu, 24 Feb 2022 at 12:48, Tomas Pilar wrote: > > > > Delay and move the allocation and mapping of memory that backs the DMA > > engine in NvmExpress devices to NvmeInit() to ensure that > > the allocation only happens after the > > EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE attribute is set > > on the PciIo controller. > > > > This ensures that the DMA-backing memory is not forcibly allocated > > below 4G in system address map. Otherwise the allocation fails on > > platforms that do not have any memory below the 4G mark and the drive > > initialisation fails. > > > > Cc: Ray Ni > > Cc: Ard Biesheuvel > > Cc: Leif Lindholm > > Signed-off-by: Tomas Pilar > > NvmeControllerInit () can be called multiple times, no? So you should > probably make sure that the buffer is not allocated and mapped again > if one already exists. > Alternatively, you could move all PCI attribute handling into the start() hook. Other drivers keep it there as well, and it seems like a more natural place for it (given the fact that NvmeControllerInit() is also called on a host controller reset)