From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74369C433ED for ; Fri, 23 Apr 2021 16:13:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D909761422 for ; Fri, 23 Apr 2021 16:13:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D909761422 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZyR1-00047k-Rg for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 12:13:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZyPx-0003fk-Aa for qemu-devel@nongnu.org; Fri, 23 Apr 2021 12:12:33 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:43657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZyPv-0007L1-IJ for qemu-devel@nongnu.org; Fri, 23 Apr 2021 12:12:32 -0400 Received: by mail-ej1-x635.google.com with SMTP id l4so74621812ejc.10 for ; Fri, 23 Apr 2021 09:12:30 -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=XZdpzXOcTxqjFSwlRbFb4i3zdLm4WGWVwAD6TdcmzW8=; b=bx7T8M0rn8trP03/foASzOB4mP+e5xxRUdvMg0E+hdzdRoB4zYTBubOwBK9ynES7SD e+/otNGL08Oxp0r8wukrvw6ITCZ+WCbUOdrxn3+pg68kyWAyPXLn+WEnxoCnEHLIv38V 3gmlVYY12yJk3p2+BognzZdonkAZf4+jRyxYO+NE/uumt+gONfmrdbXYzLntSAPA/ykv Q9+6s+pqVuexw7UTJRCAzx4ZvU+A1A5pxM1JfKkBrQsx/mM8BeTZ2m9GyT8NVtBG5PF6 gu7ARrAPxqRVnAhmiFasiKk1QR8Jh0BUgftzdRAqHr5CME+U9LCWAot8Copotua9sS26 Ji3Q== 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=XZdpzXOcTxqjFSwlRbFb4i3zdLm4WGWVwAD6TdcmzW8=; b=mf24JHKPRhec+ytdJTH2q/dJ40lfcGIQW/CP8EpL0ZmjEyhE5KM/J3XNlbyJmuQFnj 3FMtPTfd6CGVEOtl5VY9k1Mj8yw09p+nApZo08Iyw7BpExy9MC5O0yn9N9Udb4BWWp8q E8qkLcZY3+xRgKoZsXjOJOyHu61EkX7NZfb+UZkTUleDJluU4putdyOifEKaQ41gYzZS V5Sw0niPNxlHEsc0DV2lVtBvqXYL65sh4vaph1nNdpPrQRmXhOULumJ/xTRDOznDV38G 6rUBPzU3hCYnsJvgXq/eRVzDFXR2h2Rtx+4P9PE8flOy2mcE6BUQaxgzn3IWTOw+K6pk xUkA== X-Gm-Message-State: AOAM533QkJd4TTF5ALMWUq9PeF7q7Haku/eviToQk/I7mBJKi9sM1Ch+ P9jv1pG1l8WAMP6Fw4XXktmtLlR9TH4m6fi4hziepw== X-Google-Smtp-Source: ABdhPJyDSlSixAFbOnjHavccWW0qYS4OXblBD8TbXiLfXLQZPckG4f8UKyHPhXB8IOTpe4tAz6yWocPtCSCaUqcDZwQ= X-Received: by 2002:a17:906:8303:: with SMTP id j3mr5061444ejx.85.1619194349293; Fri, 23 Apr 2021 09:12:29 -0700 (PDT) MIME-Version: 1.0 References: <20210422222429.183108-1-mst@redhat.com> <20210422222429.183108-2-mst@redhat.com> In-Reply-To: From: Peter Maydell Date: Fri, 23 Apr 2021 17:11:33 +0100 Message-ID: Subject: Re: [PULL 1/2] amd_iommu: Fix pte_override_page_mask() To: Jean-Philippe Brucker Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=peter.maydell@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , QEMU Developers , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 23 Apr 2021 at 14:35, Jean-Philippe Brucker wrote: > > On Fri, Apr 23, 2021 at 02:01:19PM +0100, Peter Maydell wrote: > > On Thu, 22 Apr 2021 at 23:24, Michael S. Tsirkin wrote: > > > > > > From: Jean-Philippe Brucker > > > > > > AMD IOMMU PTEs have a special mode allowing to specify an arbitrary page > > > size. Quoting the AMD IOMMU specification: "When the Next Level bits [of > > > a pte] are 7h, the size of the page is determined by the first zero bit > > > in the page address, starting from bit 12." > > > > > > So if the lowest bits of the page address is 0, the page is 8kB. If the > > > lowest bits are 011, the page is 32kB. Currently pte_override_page_mask() > > > doesn't compute the right value for this page size and amdvi_translate() > > > can return the wrong guest-physical address. With a Linux guest, DMA > > > from SATA devices accesses the wrong memory and causes probe failure: > > > > > > qemu-system-x86_64 ... -device amd-iommu -drive id=hd1,file=foo.bin,if=none \ > > > -device ahci,id=ahci -device ide-hd,drive=hd1,bus=ahci.0 > > > [ 6.613093] ata1.00: qc timeout (cmd 0xec) > > > [ 6.615062] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4) > > > > > > Fix the page mask. > > > > > > Signed-off-by: Jean-Philippe Brucker > > > Message-Id: <20210421084007.1190546-1-jean-philippe@linaro.org> > > > Reviewed-by: Michael S. Tsirkin > > > Signed-off-by: Michael S. Tsirkin > > > > Jean-Philippe, do you know if this is a regression since 5.2? > > I don't think so, I can reproduce it with v5.2.0. OK, thanks; I think I favour not putting this into rc5, then. -- PMM