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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 1C2E0CA9EB5 for ; Mon, 4 Nov 2019 18:24:36 +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 E34E420578 for ; Mon, 4 Nov 2019 18:24:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="nxHbQbjX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E34E420578 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=163.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRh1n-0002H8-0x for qemu-devel@archiver.kernel.org; Mon, 04 Nov 2019 13:24:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42415) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRh0b-0001E9-Pw for qemu-devel@nongnu.org; Mon, 04 Nov 2019 13:23:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRh0W-0000NF-2y for qemu-devel@nongnu.org; Mon, 04 Nov 2019 13:23:17 -0500 Received: from m12-12.163.com ([220.181.12.12]:50312) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRh0U-0000Gj-To for qemu-devel@nongnu.org; Mon, 04 Nov 2019 13:23:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=MIME-Version:From:Subject:Date:Message-Id; bh=M9BWe r0vcLDAdeZ22XkCMo2MP1isMdn5SBnBrgyhGiM=; b=nxHbQbjXBuUjQ+D98b1Dj tOXGrHTgzAqLQ6D7Vli/1PY2t/Xl3u/xkVaa/fM+N+jE6LfFulPZa05DXroJxaYJ 39QF+y+it3oIbONLFrzR82SYVo250ruTW4WDRmIgMIWTJnE12M1SNIsyxnTIFsFx eGSoWlTmeKmfV3E391kAZA= Received: from [IPv6:::ffff:192.168.0.7] (unknown [115.204.244.11]) by smtp8 (Coremail) with SMTP id DMCowABXHvNqVMBdVkvORw--.48551S3; Tue, 05 Nov 2019 00:40:11 +0800 (CST) MIME-Version: 1.0 To: Alex Williamson , "eric.auger@redhat.com" , "qemu-devel@nongnu.org" , "liq3ea@gmail.com" From: Li Qiang Subject: Questions about the VFIO BAR region Date: Tue, 5 Nov 2019 00:40:39 +0800 Importance: normal X-Priority: 3 Content-Type: multipart/alternative; boundary="_0B207E59-83CD-4C1A-836C-BB915ECC71F1_" X-CM-TRANSID: DMCowABXHvNqVMBdVkvORw--.48551S3 Message-Id: <5DC05485.008EAA.00665@m12-12.163.com> X-Coremail-Antispam: 1Uf129KBjvdXoWrKryfuFW5AFWfKry8CF48WFg_yoWxZwcEg3 47Crykt3y8Wr4fZ3W3XF45Jws2va17WFZ7Gr1UXFs7tFWFg3ZY9r4vkr1qkF1jqay3Ar45 tr4rGa18Kr1UWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8iSdDUUUUU== X-Originating-IP: [115.204.244.11] X-CM-SenderInfo: 5oltjvrd6rljoofrz/1tbiTwVjbVsGSA9Y2gAAsc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.12 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --_0B207E59-83CD-4C1A-836C-BB915ECC71F1_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hello Alex, Auger and all, I have a question about the VFIO virtual device BAR. In vfio_region_setup, it initialize a =E2=80=98region->mem=E2=80=99 MR and = set its ops to =E2=80=98vfio_regions_ops=E2=80=99.=20 In =E2=80=98vfio_region_mmap=E2=80=99, it maps the physical device=E2=80=99= s MMIO to QEMU=E2=80=99s virtual address space=20 as a raw MR =E2=80=98region->mmaps[i].mem=E2=80=99.=20 And also it set the latter MR as a subregion of the first one. So when the guest accesses the BAR, it will direct go to the physical devic= e=E2=80=99s BAR. My question is here: When the qemu will use the =E2=80=98vfio_regions_ops=E2=80=99 to read/write= the BAR? Also whey in the last of =E2=80=98vfio_region_write/read=E2=80=99 we need t= o call =E2=80=98vbasedev->ops->vfio_eoi(vbasedev);=E2=80=99? Thanks, Li Qiang --_0B207E59-83CD-4C1A-836C-BB915ECC71F1_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Hello Alex, Auger= and all,

 

I have a question abou= t the VFIO virtual device BAR.

 

I= n vfio_region_setup, it initialize a =E2=80=98region->mem=E2=80=99 MR an= d set its ops to =E2=80=98vfio_regions_ops=E2=80=99.

In =E2=80=98vfio_region_mmap=E2=80=99, it maps= the physical device=E2=80=99s MMIO to QEMU=E2=80=99s virtual address space=

as a raw MR =E2=80=98re= gion->mmaps[i].mem=E2=80=99.

And also it set the latter MR as a subregion of the first one.

 

=

So when the guest accesses the BAR,= it will direct go to the physical device=E2=80=99s BAR.

My question is here:

When the qemu will use the =E2=80=98vfio_region= s_ops=E2=80=99 to read/write the BAR?

Also whey in the last of =E2=80=98vfio_region_write/read=E2=80= =99 we need to call =E2=80=98vbasedev->ops->vfio_eoi(vbasedev);=E2=80= =99?

 

 

Thanks,

Li Qiang

 

= --_0B207E59-83CD-4C1A-836C-BB915ECC71F1_--