All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Lu Baolu <baolu.lu@linux.intel.com>,
	iommu@lists.linux-foundation.org,
	LKML <linux-kernel@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Eric Auger <eric.auger@redhat.com>, Yi Liu <yi.l.liu@intel.com>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	Raj Ashok <ashok.raj@intel.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Jonathan Cameron <jic23@kernel.org>,
	jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function
Date: Thu, 14 May 2020 08:31:43 -0700	[thread overview]
Message-ID: <20200514083143.6400d813@jacob-builder> (raw)
In-Reply-To: <20200514055424.GC22388@infradead.org>

On Wed, 13 May 2020 22:54:24 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> > +	 * 1. CPU vs. IOMMU
> > +	 * 2. Guest vs. Host.
> > +	 */
> > +	switch (addr_width) {
> > +#ifdef CONFIG_X86
> > +	case ADDR_WIDTH_5LEVEL:
> > +		if (cpu_feature_enabled(X86_FEATURE_LA57) &&
> > +		    cap_5lp_support(iommu->cap)) {
> > +			pasid_set_flpm(pte, 1);
> > +		} else {
> > +			dev_err_ratelimited(dev, "5-level paging
> > not supported\n");
> > +			return -EINVAL;
> > +		}
> > +		break;  
> 
> The normal style would be to handle the early error return first:
> 
> 		if (!cpu_feature_enabled(X86_FEATURE_LA57) ||
> 		    !cap_5lp_support(iommu->cap)) {
> 			dev_err_ratelimited(dev,
> 				"5-level paging not supported\n");
> 			return -EINVAL;
> 		}
> 
> 		pasid_set_flpm(pte, 1);
> 		break;
> 

Sounds good. I was thinking in positive logic.

thanks

WARNING: multiple messages have this Message-ID (diff)
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Raj Ashok <ashok.raj@intel.com>,
	David Woodhouse <dwmw2@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	iommu@lists.linux-foundation.org,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function
Date: Thu, 14 May 2020 08:31:43 -0700	[thread overview]
Message-ID: <20200514083143.6400d813@jacob-builder> (raw)
In-Reply-To: <20200514055424.GC22388@infradead.org>

On Wed, 13 May 2020 22:54:24 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> > +	 * 1. CPU vs. IOMMU
> > +	 * 2. Guest vs. Host.
> > +	 */
> > +	switch (addr_width) {
> > +#ifdef CONFIG_X86
> > +	case ADDR_WIDTH_5LEVEL:
> > +		if (cpu_feature_enabled(X86_FEATURE_LA57) &&
> > +		    cap_5lp_support(iommu->cap)) {
> > +			pasid_set_flpm(pte, 1);
> > +		} else {
> > +			dev_err_ratelimited(dev, "5-level paging
> > not supported\n");
> > +			return -EINVAL;
> > +		}
> > +		break;  
> 
> The normal style would be to handle the early error return first:
> 
> 		if (!cpu_feature_enabled(X86_FEATURE_LA57) ||
> 		    !cap_5lp_support(iommu->cap)) {
> 			dev_err_ratelimited(dev,
> 				"5-level paging not supported\n");
> 			return -EINVAL;
> 		}
> 
> 		pasid_set_flpm(pte, 1);
> 		break;
> 

Sounds good. I was thinking in positive logic.

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

  reply	other threads:[~2020-05-14 15:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 23:01 [PATCH v13 0/8] Nested Shared Virtual Address (SVA) VT-d support Jacob Pan
2020-05-13 23:01 ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 1/8] iommu/vt-d: Move domain helper to header Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 2/8] iommu/vt-d: Use a helper function to skip agaw for SL Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-14  5:51   ` Christoph Hellwig
2020-05-14  5:51     ` Christoph Hellwig
2020-05-14 15:20     ` Jacob Pan
2020-05-14 15:20       ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-14  5:54   ` Christoph Hellwig
2020-05-14  5:54     ` Christoph Hellwig
2020-05-14 15:31     ` Jacob Pan [this message]
2020-05-14 15:31       ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 4/8] iommu/vt-d: Add bind guest PASID support Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-14  5:59   ` Christoph Hellwig
2020-05-14  5:59     ` Christoph Hellwig
2020-05-14 15:57     ` Jacob Pan
2020-05-14 15:57       ` Jacob Pan
2020-05-15  1:01       ` Lu Baolu
2020-05-15  1:01         ` Lu Baolu
2020-05-16  6:02       ` Lu Baolu
2020-05-16  6:02         ` Lu Baolu
2020-05-13 23:01 ` [PATCH v13 5/8] iommu/vt-d: Support flushing more translation cache types Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 6/8] iommu/vt-d: Add svm/sva invalidate function Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 7/8] iommu/vt-d: Enlightened PASID allocation Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-13 23:01 ` [PATCH v13 8/8] iommu/vt-d: Add custom allocator for IOASID Jacob Pan
2020-05-13 23:01   ` Jacob Pan
2020-05-16  6:31 ` [PATCH v13 0/8] Nested Shared Virtual Address (SVA) VT-d support Lu Baolu
2020-05-16  6:31   ` Lu Baolu
2020-05-15 21:11 [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function kbuild test robot

Reply instructions:

You may reply publicly 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=20200514083143.6400d813@jacob-builder \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=eric.auger@redhat.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jean-philippe@linaro.com \
    --cc=jic23@kernel.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yi.l.liu@intel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.