IOMMU Archive on lore.kernel.org
 help / color / Atom feed
From: Wei Hu via iommu <iommu@lists.linux-foundation.org>
To: "hch@lst.de" <hch@lst.de>
Cc: "sashal@kernel.org" <sashal@kernel.org>,
	"info@metux.net" <info@metux.net>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"b.zolnierkie@samsung.com" <b.zolnierkie@samsung.com>,
	"sam@ravnborg.org" <sam@ravnborg.org>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	Michael Kelley <mikelley@microsoft.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"mchehab+samsung@kernel.org" <mchehab+samsung@kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>
Subject: RE: [PATCH] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
Date: Fri, 25 Oct 2019 08:09:34 +0000
Message-ID: <PU1P153MB0169EA21993B5893EA7569FABB650@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20191023091037.GB21910@lst.de>

Thanks for the review. Please see my response inline.

> > +	select DMA_CMA
> 
> Thіs needs to be
> 
> 	select DMA_CMA if HAVE_DMA_CONTIGUOUS
> 
> > +#include <linux/dma-contiguous.h>
> 
> > +	/* Allocate from CMA */
> > +	// request_pages = (request_size >> PAGE_SHIFT) + 1;
> > +	request_pages = (round_up(request_size, PAGE_SIZE) >> PAGE_SHIFT);
> > +	page = dma_alloc_from_contiguous(NULL, request_pages, 0, false);
> 
> dma_alloc_from_contiguous is an internal helper, you must use it
> through dma_alloc_coherent and pass a struct device to that function.
> 

Can I directly use cma_alloc() and cma_release() in this case? The contiguous
memory allocated is just for virtual framebuffer device, not for any DMA
operation. I think using dma_alloc_coherent() might be a bit of overkill.

> > +	if (!gen2vm) {
> > +		pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
> > +			PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
> > +		if (!pdev) {
> > +			pr_err("Unable to find PCI Hyper-V video\n");
> > +			return -ENODEV;
> > +		}
> > +	}
> 
> Please actually implement a pci_driver instead of hacks like this.
> 

I don't quite follow this. What do you mean implementing a pci_driver
in this case?

> > +			par->need_docopy = false;
> > +			goto getmem1;
> > +		} else {
> 
> No need for an else after a goto.
Thanks. Will do.

Wei
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 11:10 Wei Hu via iommu
2019-10-23  9:10 ` hch
2019-10-25  8:09   ` Wei Hu via iommu [this message]
2019-11-02  0:28 ` Michael Kelley via iommu
2019-11-02  6:17 ` Dexuan Cui via iommu

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PU1P153MB0169EA21993B5893EA7569FABB650@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM \
    --to=iommu@lists.linux-foundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=b.zolnierkie@samsung.com \
    --cc=decui@microsoft.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=hch@lst.de \
    --cc=info@metux.net \
    --cc=kys@microsoft.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=robin.murphy@arm.com \
    --cc=sam@ravnborg.org \
    --cc=sashal@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=weh@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

IOMMU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iommu/0 linux-iommu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iommu linux-iommu/ https://lore.kernel.org/linux-iommu \
		iommu@lists.linux-foundation.org
	public-inbox-index linux-iommu

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linux-foundation.lists.iommu


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git