From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::143; helo=mail-it1-x143.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CCF9A211E958E for ; Thu, 28 Mar 2019 04:39:03 -0700 (PDT) Received: by mail-it1-x143.google.com with SMTP id h9so5500682itl.1 for ; Thu, 28 Mar 2019 04:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Epw+lSeA4V8VgCh44KKU4OkCoAaq4gjXzkw2lCLBVHg=; b=BriiHUeI7zzIbE9+qjNx7FWD0MnbVa+eCvT4aYshKgWf4caMUh/i05OcnY0gdCdxl7 haf65rfvUjD3ocZ65Pjzs9AIYJI1n6oOH4lx6vRL5d/hSXuGvqWFXpzRofSQ+wMp9Btf eanex5jNEFhr0FMdbNaIVF0DSTKyFNu7QgG8+JSIuhen7lRv+KKpveLQxC3AdC6oZfgQ o5J+tR2X+xJqeGB31OBUhxn+ppJBjBjLhXjmWzr5vhOncmc+9aKRkt4l8aAu7HpM7Fds zVGJlM8mHWkTM7XvJHwY1sDRFteZv+s1vLVICJEnmUyPTIYUedIgsB/xAYwzoNstWsGZ 3a8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Epw+lSeA4V8VgCh44KKU4OkCoAaq4gjXzkw2lCLBVHg=; b=s5YBmTh3Xch71aUjcHWGBw/y+4ZOpnLMg6msck9yO6v+NNzE5G8GdoCMOLzZlpVikQ llssD8tx2PT+wh5RWOzWlcc3w9/tjofVfY08TLAbqBfNX8x5Ea2TzZXjUt90KnPhtj3d Kno2gA0yttTlLCmXuQ3bccILMhneyYThDAqh+rruL9aXBY4Mq0ZqDTpFI8aBxN2Nq1Fw ZuHLpP/dyB/uW0FeEiHamnyaYtrxiQ4d4Z5GAaEkA00MXhJHIVdFoCous+9uFA3zXHtv x9SvGUirgD42fV3jq0LVE8GY11uNSeDlgsROtawTz54mtmTV98xzSCyFYafEgh/vEX7m jfvA== X-Gm-Message-State: APjAAAUvyhDBeQT1AG/wQFUgjymbf93kaX3/BBhvs6VZPe72XsOGmtMJ tYx+3Ongk/PJK0uxeQpSq2IA1d2OLhwir15uOeKRSQ== X-Google-Smtp-Source: APXvYqxQV3nSMCXmVW90mWEsS3ntZmlXI/j8jfKBMqLIzOxi1EdQ76yEvpWhhlz/whYkb2AkyVX17fyQY/3b7FjnAfw= X-Received: by 2002:a02:9f19:: with SMTP id z25mr27078546jal.2.1553773142414; Thu, 28 Mar 2019 04:39:02 -0700 (PDT) MIME-Version: 1.0 References: <20181106175833.26964-1-ard.biesheuvel@linaro.org> <48d303c0db5d5007203a1557d7e5728d19550201.camel@linux.intel.com> In-Reply-To: <48d303c0db5d5007203a1557d7e5728d19550201.camel@linux.intel.com> From: Ard Biesheuvel Date: Thu, 28 Mar 2019 12:38:50 +0100 Message-ID: To: Ryszard Knop Cc: "edk2-devel@lists.01.org" , "Kacperski, Kamil" , "Jin, Eric" , "Orlowski, Pawel" , "Kinney, Michael D" , "Hsiung, Harry L" Subject: Re: [PATCH edk2-staging 00/19] IntelUndiPkg/GigUndiDxe: build fixes for AARCH64/ARM/GCC X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Mar 2019 11:39:04 -0000 Content-Type: text/plain; charset="UTF-8" On Thu, 28 Mar 2019 at 11:46, Ryszard Knop wrote: > > On Wed, 2019-03-27 at 16:32 +0100, Ard Biesheuvel wrote: > > On Tue, 29 Jan 2019 at 14:55, Ryszard Knop < > > ryszard.knop@linux.intel.com> wrote: > > > +Team > > > > > > > As it turns out, this driver is still broken for non-1:1 mapped DMA. > > > > In particular, I am hitting a crash on > > > > E1000MemCopy ( > > (UINT8 *) (UINTN) CpbReceive->BufferAddr, > > (UINT8 *) (UINTN) ReceiveDescriptor->buffer_addr, > > TempLen > > ); > > > > (around line 676 in e1000.c), which uses the DMA address > > 'ReceiveDescriptor->buffer_addr' in a memory copy operation performed > > by the CPU. This causes a crash on systems where the DMA address is > > not also a valid CPU address. > > Huh, this is new... I don't have access to any system behaving this > way, so I can't test this, but E1000.c -> E1000TxRxConfigure links > RxDesc->buffer_addr to the physical addresses, that descriptor is used > by the hardware to DMA data where needed, and we try to copy from that > same physical address later, while we should copy from unmapped > addresses instead. > Indeed. > This probably should be solved by having a separate array/something > with CurRxInd -> unmapped addresses, but I'll have to talk with my team > to solve this in a sensible way. > > In the meantime, maybe you know if there's a way to simulate this > situation under QEMU or something? > I am using an arm64 board with modified firmware to emulate different PCIe host bridge configurations. I don't know whether QEMU has support for non-1:1 mapped DMA on x86, but it does emulate various boards (such as the raspberry pi 2 iirc) where the CPU and device addressing is not 1:1.