lkml.org 
[lkml]   [2020]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function
    > +	 * 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;

    \
     
     \ /
      Last update: 2020-05-14 07:54    [W:2.153 / U:0.940 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site