Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2461794imm; Thu, 27 Sep 2018 13:17:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV60CYIYurA7A1vRXjZ8wwPlSA7e8CpPn3dJtVEuq6/R0qBXmbWIP76IzpXxOowM1X1GLIBhG X-Received: by 2002:a63:920b:: with SMTP id o11-v6mr7019955pgd.141.1538079477396; Thu, 27 Sep 2018 13:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538079477; cv=none; d=google.com; s=arc-20160816; b=lF6hoAEVQglgo29O0InM40DBIjTVv67ecCmXojAbfFqgw5wySxthBxTVzGUEOzjUlt ygI2Kv/wQ9K2M3VHt4blvRsVj52VEx9eIQu14B/s9kif0dqTyLwjTjifkL4zrnXq7Orj kUeK9Mzlfhr45qQHQ4rs3cjP+xAG/wkqe3cdsdwJB6AVCGpbbntfcwFUCdqkMOW4eWNn 9UWxfepoo4+zF6vDecKwKF4KGkGVmUE6gnSE7FvxydugfUiadkM/FEjhA3ItMEsgXwDG v4XZ0B5iKpUcIWdeKn8DO3fLUf/6CcGAtLGcPgUKBNYo3Scp3SxbnWeOquYDKuS2aVpB HyYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=TO0BI/dg9dv5l/IWQ8t3f8AU0BpHiR+4Q8P6V5ftCn4=; b=jFPpMWxYC3drLZxYiaRRM3ZhIoCrvBluYdx7QjtLW/t8XIj+ZMhz67fgdAjqN+EZeu lAIL3AESGDNKRADUTwnjB/q60S2LF+glPXV4/IgOHUihEY0TROPBAh/VEsHmtwvGNL8p TRNPqFk6dhhHRBE9IlkvZbgfIj/O45z0+bLQB8UBaRI2exzvrAfEHINuVdyaMsOcvtLe +2t4wtE4OZwq3q7gH8wzl8d3My4ljNDGOss+fQnAO2H3ABWT4cjCY8+oLfeKFbXXgoU8 rYFBsaG/e4dzu19JpDPdCsVCQwbOFbhl/i/Ozxc94OZwTFy25Nzh8zD6sbYbf5mpvZyv r/4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c205-v6si2811137pfc.74.2018.09.27.13.17.40; Thu, 27 Sep 2018 13:17:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728122AbeI1ChM (ORCPT + 99 others); Thu, 27 Sep 2018 22:37:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54049 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbeI1ChM (ORCPT ); Thu, 27 Sep 2018 22:37:12 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7C313002737; Thu, 27 Sep 2018 20:17:12 +0000 (UTC) Received: from t450s.home (ovpn-116-42.phx2.redhat.com [10.3.116.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07A762010CAA; Thu, 27 Sep 2018 20:17:06 +0000 (UTC) Date: Thu, 27 Sep 2018 14:17:06 -0600 From: Alex Williamson To: Kirti Wankhede Cc: Gerd Hoffmann , , , open list Subject: Re: [PATCH v3 2/2] vfio: add edid support to mbochs sample driver Message-ID: <20180927141706.1d15a579@t450s.home> In-Reply-To: <4b9847dd-c37d-1d5d-3343-7030e62894fb@nvidia.com> References: <20180921083013.15028-1-kraxel@redhat.com> <20180921083013.15028-3-kraxel@redhat.com> <4b9847dd-c37d-1d5d-3343-7030e62894fb@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 27 Sep 2018 20:17:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Sep 2018 01:27:16 +0530 Kirti Wankhede wrote: > On 9/21/2018 2:00 PM, Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > > @@ -964,6 +1050,20 @@ static int mbochs_get_region_info(struct mdev_device *mdev, > > region_info->flags = (VFIO_REGION_INFO_FLAG_READ | > > VFIO_REGION_INFO_FLAG_WRITE); > > break; > > + case MBOCHS_EDID_REGION_INDEX: > > + ext->base.argsz = sizeof(*ext); > > + ext->base.offset = MBOCHS_EDID_OFFSET; > > + ext->base.size = MBOCHS_EDID_SIZE; > > + ext->base.flags = (VFIO_REGION_INFO_FLAG_READ | > > + VFIO_REGION_INFO_FLAG_WRITE | > > + VFIO_REGION_INFO_FLAG_CAPS); > > Any reason to not to use _MMAP flag? > How would QEMU side code read this region? will it be always trapped? > If vendor driver sets _MMAP flag, will QEMU side handle that case as well? > I think since its blob, edid could be read by QEMU using one memcpy > rather than adding multiple memcpy of 4 or 8 bytes. "Trapping" would only come into play if the region were exposed to the VM, which there's no intention to do here afaik. Also, just because it doesn't support mmap doesn't mean that QEMU necessarily needs to break down accesses into smaller words, QEMU could do: pwrite(fd, buf, edid_max_size, region_offset + edid_offset) ie. write the entire edid area with one operation. I don't think there's anything in the specification that prevents mmap now, edid_offset could be at a page alignment, edid_max_size could be PAGE_SIZE, and a sparse mmap capability could indicate that only the EDID area is mmap'able, but is it worth the code to support that? Thanks, Alex